Files
plugins/packages/kimi-work/tests
yetone 8310fd2e77 kimi-work 0.1.8: Kimi gets the headers its own Work client sends, not "Magpie Kimi Work provider" (#353)
Every request to agent-gw and kimi.com carried the User-Agent "Magpie Kimi
Work provider/<version>". Kimi 3.2.20's daimon 0.6.10 (the desktop
component that holds the Work credential in daimon-share/daimon/config.json)
builds its agent-gw headers in createDaimonKimiCodeRequestHeaders:
User-Agent kimi-code-cli/<Kimi Code version> (0.36.0, from its
kimi-code.vendor.json; no caller passes a suffix), X-Msh-Device-Id,
X-Msh-Device-Model, X-Msh-Device-Name, X-Msh-Os-Version, X-Msh-Platform
"kimi-code-cli", X-Msh-Version and X-Msh-Daimon-Version 0.6.10. The plugin
sends the same on /models and /chat/completions.

The device id is the daimon's own: a randomUUID it writes once to
<daimon>/runtime/kimi-code/home/device_id. The plugin reads that file and
never writes it (it never writes the desktop app's files); when it is
missing the header is left out. The www.kimi.com reads (membership, and
0.1.7's DescribeKimiWorkConfig menu) get the kimi-code-cli User-Agent
only: those calls are made by Kimi's web page, whose own headers weren't
read.

The test also found magpie's x-magpie-* hint headers going through to
agent-gw on chat requests; they are now dropped.

Run:
- no-magpie.test.mjs: models, the Work menu, chat (with a magpie User-Agent and an
  x-magpie-work-dir coming in) and membership hold no "magpie"; agent-gw
  gets the daimon's headers; the device id is read and never written.
  Both tests red on 0a9415f (0.1.7).
- bun test (package, rebased on 0a9415f): 48 pass. bun scripts/check.mjs kimi-work: ok.
Not tried live: no Kimi Work account here, and Kimi isn't installed on
this Mac or the Windows box.
2026-10-24 17:30:44 +08:00
..