7b42e404f5f656d7bfb4aa5c7ddbcd1031264a86
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
280d522830 |
kimi-work 0.1.15: renew membership tokens and keep existing accounts (#218)
Explicit sign-in now imports Kimi desktop's membership access/refresh pair when the desktop has one, and magpie renews it through the host's auth.refresh (conditional commit under the auth-store lock). Accounts saved through 0.1.14 (reference-only, no pair) keep reading the desktop's web token for usage, with no reconnect, no import and no refresh spent. The usage card is one monthly meter, with Code's share as text. Request-body reads follow the caller's abort signal. Kept from main (0.1.11 to 0.1.14): callback errors split into no session / Work 401 / HTTP-timeout-network (#425), per-uid account ids `Kimi Work · <uid6>` (#440), share-folder-missing as kept (#444), spent-quota 403 -> 429 (#465). Reviewed head 96f7f52501082e4747ef649d836d955a8ece3f4c, merged onto origin/main |
||
|
|
eb54fad5b3 |
kimi-work 0.1.13: a gone share folder is named, and several Kimi users are served (#444, #440)
#444 (kongbai01203): when the folder daimon-storage.json points to was moved or deleted, 0.1.12 threw its "sign in again" error with signIn "expired", so magpie showed "登录已失效" and marked the account, and signing in again in a running Kimi didn't help. Kimi 3.2.21 makes <shareDir>/daimon only when it provisions at start, and never falls back to the default folder while a pointer stands (read from its main process), so the plugin doesn't fall back either. A missing share folder is now its own error, kimi_work_share_missing, with signIn "kept": it names the folder and says to put it back (no new sign-in) or to quit and reopen Kimi, then sign in to Work. The sign-in callback shows the same text. A share folder that exists but has no config.json is still the old missing-sign-in error. The plugin's fetch already fails before any network call; the ~30s 502 the reporter saw is outside the plugin and was not looked into here. #440 (kongbai01203): magpie already keeps a second Kimi user beside the first (settle tells them apart by uid), but the plugin served only the user Kimi is signed in to, so the first account failed once Kimi switched. Kimi 3.2.21 keeps one minted Work key per user in <daimon>/kimi-code-key.json ({"v":2,"keys":[{userId,apiKey,keyId?}]}, the current user first), keeps an entry when it switches users, reuses it when it switches back, and drops one only on a 401 (DaimonProvision's #readKeyStore/#upsertKeyStoreEntry/#resolvePersistedKimiCodeApiKey). An account Kimi has switched away from now uses its key from that file, read as Kimi reads it (v 2 only, first entry per user). Its allowance can't be read (Kimi keeps only the current user's web sign-in), so its usage card says to switch to it, signIn "kept". No key, or a key the gateway refuses, is kimi_work_account_not_here, marked signed out. Each account is named "Kimi Work · <first 6 of its hashed uid>" instead of the shared "Kimi Work (local)". Not done: rotating between accounts or falling back on quota, which is magpie's routing, not the plugin's. Run: bun test in packages/kimi-work (65 pass) and the whole repo with HOME and TMPDIR in a sandbox under magpie-wt (2879 pass, 3 skip, 3 fail: cursor upstream-words, commandcode no-magpie and layerfs no-magpie, which fail because the sandbox path itself contains "magpie"; none of those packages is touched). bun scripts/check.mjs ok. Broken by hand: index.mjs at origin/main fails the new share-folder, reporter's D:\KimiData\daimon-share and two-users tests. In the new code, dropping the share check reds the two #444 tests; ignoring the key store reds both #440 tests; taking the last entry per user reds the key-store test; reading usage for an away account reds the two-users test. Not tried: a real Kimi with two users (no Kimi install or Kimi account on this machine); that a minted key still works server-side after Kimi switches users is read from Kimi's code (it reuses it after a probe), not seen. Not tried on Windows. |
||
|
|
a9779ef864 |
kimi-work 0.1.12, kimi-desktop 0.1.4: Kimi's sign-in is read where daimon-storage.json points (#425)
Kimi 3.2.21 on Windows, installed on another drive than %APPDATA%'s,
keeps daimon-share at <install drive>\KimiData\daimon-share and writes
%APPDATA%\kimi-desktop\daimon-storage.json ({"version":1,"shareDir":...})
to point there. It writes the same pointer on any system when the user
moves its storage. Both packages read only
%APPDATA%\kimi-desktop\daimon-share, so the sign-in was "not found".
Read from Kimi's own code: Kimi-Setup-3.2.21.exe's app.asar,
out/main/index.js (string table decoded): the shareDir getter is
readPointer(userData) ?? join(userData, "daimon-share"); the pointer
reader takes an absolute shareDir and otherwise the default; the
"install-drive seed" writes the pointer on win32 when installRoot's drive
differs from userData's; driveDataDirName is "KimiData".
Both packages now follow the pointer the same way (unreadable, non-JSON
or non-absolute -> default, as Kimi does). kimi-work's sign-in failure
names the file it looked for, and a failed Work check (network, HTTP)
no longer says no sign-in was found.
Run at this tree (base
|