CNSA0422 on X: magpie didn't count local usage from the Kimi desktop
app. Its Work agent is Daimon, which runs the Kimi Code runtime it
vendors with its own home under the app's share folder, so its calls
are written as Kimi Code's usage.record lines in a folder magpie never
looked in.
Read from Kimi 3.2.27's own bundle (com.moonshot.kimichat, Daimon
1.0.10, Kimi Code runtime 0.5.1): the app passes KIMI_SHARE_DIR, which
is <userData>/daimon-share or the absolute shareDir in
<userData>/daimon-storage.json; Daimon alone falls back to ~/.kimi.
The sessions are <share>/daimon/runtime/kimi-code/home/sessions/<slug>/
<id>/agents/<agent>/wire.jsonl. userData is kimi-desktop under
~/Library/Application Support, %APPDATA% or ~/.config.
- kimi_work.go finds the shares and adds their wire files to Kimi
Code's ("kimi"), as MiniMax Code Desktop's count as MiniMax Code's.
Found() lists kimi when only Work sessions exist.
- A record's model is Daimon's alias (daimon-kimi-code). It is read
as the alias's model in the runtime's config.toml (k2p6-agent).
- magpie's kimi-desktop plugin points the alias's provider at a bridge
on 127.0.0.1 that forwards to the gateway, which logs those calls.
A call whose alias's base_url is a loopback address is skipped, so
it is not counted twice. config.toml is the current setting only,
so history read for the first time is judged by it.
- docs/subsystems/gateway-sessions.md says so.
Run (mote): go test ./internal/sessions -count=1, ok;
go vet ./internal/sessions for darwin, windows, linux -tags nogui, ok.
Windows (xiaomi-gpu, win-run): go test ./internal/sessions
-run 'KimiWork|Loopback|KimiCode', ok. gofmt clean.
Broken by hand: kimiCallFiles without the Work files made
TestKimiWorkCalls red (no calls), and so did dropping the loopback skip
(the bridged call counted). Restored, green.
Not tried: a real Kimi Work session. This computer has no Kimi desktop
data, so the fixture's records are the Kimi Code format the bundle's
UsageRecord writes and its config.toml is what modelToToml builds. The
Windows installer was not unpacked: the Windows path is Electron's
userData as the bundle's code reads it. k2p6-agent has no price in the
catalog, so these calls show tokens and no cost.