# Kimi Work 0.1.15 compatibility ## Scope This candidate incorporates upstream `3b3209e0ddd2c47ee5c8f77b5541131e0aa178fe` (kimi-work 0.1.14), including storage-pointer discovery, separate missing-session/401/connection errors, per-user account IDs and retained Work keys, membership-card errors/omitted-zero parsing, and spent-quota 403โ†’429 mapping. Reference-only accounts retain read-only desktop usage without forced reconnect. The interfaces remain undocumented and can change. The historical 2026-10-24 live renewal test at `f67d742` used Apple-silicon macOS and official Kimi Desktop **3.2.17** (build 3.2.17.4). A fresh, user-completed login belongs to disposable profiles. The installed application and everyday Magpie/Kimi profiles are not the test credential source. A temporary application copy keeps the original `app.asar` byte-for-byte; its main-source SHA-256 is `6a37077974207f7b501add47d9756eaff8d41eb87347e05b11f59f7b2386c439`. Test-only launch instrumentation redirects profile paths and exposes the original AuthService and TokenStore methods for invocation/observation; no refresh response is substituted. ## RefreshToken request comparison Endpoint: `POST https://auth.kimi.com/api/account.gateway.v1.AuthService/RefreshToken`. The official native request was observed at **2026-10-24 15:14:47 UTC**, HTTP **200**, producing changed access and refresh tokens. The full request-header names below come from Electron's send-headers event; private values were redacted in memory before recording. | Header | Official desktop 3.2.17 | Plugin's explicit request | | --- | --- | --- | | `Authorization`, `Cookie` | Both absent | Both absent; regression asserted | | `User-Agent` | Chromium UA containing `kimi-desktop/3.2.17 Chrome/150.0.7871.250 Electron/43.7.3` | Same captured macOS UA; OS portion follows platform | | `x-msh-platform` | `mac` | `mac` on macOS, `windows` on Windows, `web` otherwise | | `x-msh-version` | `3.2.17` | `3.2.17` for AuthService only | | `R-Timezone` | `Asia/Singapore` | Runtime timezone (`Asia/Singapore` in this run) | | `X-Language` | `zh-CN`, from the native desktop locale | Runtime locale (`en-US` in this run) | | `Connect-Protocol-Version` | `1` | `1` | | `Content-Type` | `application/proto` | `application/json` | | `x-msh-device-id`, `x-msh-session-id`, `x-msh-shield-data` | Present; values redacted | Omitted; no browser identity/signature copied | | `X-Traffic-Id` | Absent before token import; present on the later signed-in renewal, value redacted | Omitted; no account identifier copied | | `Sec-Fetch-Site`, `Sec-Fetch-Mode`, `Sec-Fetch-Dest` | `none`, `no-cors`, `empty` | Only `Sec-Fetch-Mode: cors`, generated by Node | | `Accept-Encoding` | `gzip, deflate, br, zstd` | `br, gzip, deflate, zstd`, generated by Node | | `Accept-Language` | Chromium's Chinese/English preference list | `*`, generated by Node; no browser preferences imported | | `Accept` | Not explicitly present in the capture | `application/json` | The request bodies use the same `RefreshTokenRequest.refresh_token` field. The original SDK selects protobuf by default and also implements Connect JSON with `useProtoFieldName: true` when its `KIMI_CAPTURE` option is set. The plugin uses that JSON representation, rather than adding a protobuf runtime. The official interceptor adds device/session/shield fields only when available; the plugin does not mint or reuse those browser-owned values. These are intentional differences, not a claim of byte-identical requests. The real plugin request at **15:21:07 UTC** was accepted with **200**, changed both tokens, and read `GetSubscriptionStats` with **200** at **15:21:08 UTC** without those optional fields. Plugin transport-generated fields above were observed through Node's `undici:request:create` event on the **15:36:50 UTC** real renewal, in addition to the explicit fetch options. The observer redacted non-allowlisted values before recording. Native `X-Language` is corroborated by the original locale getter/interceptor; no private header value is included here. The complete official `Accept-Language` value was `zh-CN,zh;q=0.9;q=0.9,en-US;q=0.8;q=0.8,en;q=0.7;q=0.7`. `refreshHeaders` is used only for the exact AuthService URL. Work gateway requests retain upstream's `kimi-code-cli/0.36.0` and daimon 0.6.10 device headers. www.kimi.com requests retain upstream's 3.2.20 desktop-menu metadata; the separate www User-Agent discussion remains #363. ## Shared refresh lineage: both directions All times are **2026-10-24 UTC**. The two consumers begin with the same pair from the new temporary login. The plugin uses the actual production `auth.refresh`/`auth.usage` hooks in an isolated harness; the desktop uses its original AuthService and TokenStore. This run does not exercise Magpie's credential-file commit path. | Time | Operation and observation | | --- | --- | | 15:14:47 | The official native RPC returns the shared starting pair. Desktop access expires at 15:29:47. | | 15:21:07โ€“08 | Plugin rotates that pair; both tokens change and monthly stats return 200. Only this initial round forces the hook's expiry metadata to start promptly. The desktop still holds the original pair. | | 15:29:53โ€“54 | After the desktop access expires naturally, its original `TokenStore.ensureValidToken()` uses the retained old refresh and receives 200/new access/new refresh. This is over eight minutes after the plugin's rotation, rather than an immediate replay. | | 15:30:06 | The native desktop's renewed access reads membership stats with 200; the Work key in its own temporary daemon file reads `/models` with 200. | | 15:36:50 | The plugin's previously retained access expired naturally at 15:36:07. Calling `auth.refresh` with its unmodified stored expiry rotates its own retained refresh successfully (200), then monthly stats return 200. No desktop re-import occurs; the desktop pair remains unchanged and fresh. The temporary browser has already been closed. | | 15:37:30 | Native membership stats and the temporary desktop's Work `/models` still return 200. | This session therefore did **not** show single-use rotation that immediately invalidates the other consumer. Both retained branches renewed successfully over the observed interval. It does not establish an unlimited reuse/grace period, future revocation behavior or months of coexistence. If either saved branch is later rejected, the provider shows an explicit reconnect hint; it does not silently switch accounts or rewrite the desktop's credentials. ## Account storage and compatibility Existing reference-only accounts through 0.1.14 continue using the desktop webToken after checking the saved uid. The access token is reread on each usage call, without writing auth state, consuming the desktop refresh token or silently importing a pair. If Kimi has switched users, upstream's retained Work keys still serve chat; legacy membership usage shows the switch-account hint and never borrows the current user's membership token. Explicit sign-in imports a complete membership pair when available; a desktop without refresh still produces a usable reference-only account. New account IDs retain upstream's `Kimi Work ยท ` plus the first six characters of the hashed uid. The upgrade neither renames nor deletes old entries. Paired accounts read their own host-saved membership access independently of the current desktop user. Only `auth.refresh` rotates a pair and returns fields for the host's conditional commit; usage never saves or rotates. Magpie checks the expected access/refresh pair under the auth-store lock. Pending exchanges and cached rotations are keyed by exact credentials, including independent reconnects for the same user. Membership failures keep the independent Work sign-in: a legacy 401 says to open Kimi desktop, a paired 401 gives an explicit reconnect hint, and HTTP/timeout/missing-balance errors are returned on the card. An AuthService 401 throws a membership-only `signIn: kept` error with a reconnect/CLI hint. It preserves the host retry backoff and does not mark the independent Work account expired; a Work gateway 401 retains its original expired semantics. The plugin creates no token file or desktop backup and never writes Kimi's configuration. Magpie's credential file uses atomic flushed writes and mode `0600`; it is private plaintext, not an encrypted vault. ## Regression validation Run `bun test packages/kimi-work`, full `bun test`, and `bun scripts/check.mjs kimi-work` with a disposable HOME/XDG profile. Current coverage includes upstream's storage pointers, callback error categories, distinct account IDs and retained keys, spent/non-spent 403 handling, omitted zero/snake_case membership balances, and the renewal/body-cancellation cases. Added legacy cases assert successful quota reads, no reconnect/migration/refresh, and rereading desktop access after rotation. Results, independent review and fork workflow evidence are tied to the final commit in PR #218. The historical live sequence above covers one shared-lineage cycle. Its temporary credential profiles were removed after that run. No second real coexistence cycle or new 0.1.15 live sign-in/renewal is claimed by the current synthetic regression tests. ## Limits The monthly meter reports `subscriptionBalance.amountUsedRatio`; Code's share is text from `subscriptionBalance.kimiCodeUsedRatio`, never a second allowance. Expiration fields are not asserted to be reset times. Inference continues to read the local desktop Work key and enforce its exact gateway origin/account binding. Membership renewal does not replace a revoked Work key. The historical live test covered renewal and read-only membership/model access, not an inference or desktop UI conversation at the current revision. Previous macOS and Windows streaming checks are historical coverage. Windows refresh, Linux, Intel macOS, long sleep/offline intervals, months of continuous renewal and future server revocation policy remain unverified. Automatic renewal does not guarantee a permanent session.