Skip to content

kimicode: session discovery fixes + subscription quota in menubar#799

Open
iamtoruk wants to merge 2 commits into
mainfrom
fix/kimicode-visibility
Open

kimicode: session discovery fixes + subscription quota in menubar#799
iamtoruk wants to merge 2 commits into
mainfrom
fix/kimicode-visibility

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

What

Kimi Code session visibility (CLI/dashboard)

  • Resolve k3 / k3-agent / k2d6-agent model aliases to canonical names (Kimi K3, Kimi K2.6) so sessions stop showing raw aliases
  • Discover sessions across all Kimi Code homes (CLI ~/.kimi-code + desktop runtime), not just the first
  • Accept conv-* / ctitle-* session directory naming alongside session_*
  • Add the Kimi Code provider tab (with brand color) to the menubar

Kimi Code subscription quota (menubar)

  • New KimiSubscriptionService: reads ~/.kimi-code/credentials/kimi-code.json directly (no keychain copy) and polls GET https://api.kimi.com/coding/v1/usages, mirroring the existing Codex/Claude quota services
  • Quota chip on the Kimi Code tab (Weekly + 5-hour windows), a Plan insight, and a Kimi tab in Settings with connect/disconnect
  • Lenient decoding: string-or-number values, enum-style time units (TIME_UNIT_MINUTE 300 → 5-hour), used derived from remaining when absent, ISO-8601 or epoch reset times
  • 429 backoff honoring Retry-After; expired tokens (15-min lifetime, CLI-owned refresh) surface as terminal with automatic recovery on the next tick after the CLI renews them
  • Independent cadence anchor so Kimi-only setups respect the configured refresh interval instead of polling every payload tick
  • Plan tab stays reachable for quota-capable providers even on days with no local usage

Tests

  • 8 new KimiUsageParsingTests fixtures, including one captured from the live API response
  • Full Swift suite green (38/38); affected JS suites updated and passing

Notes

  • No OAuth self-refresh by design (CodexBar parity): the Kimi CLI owns token renewal
  • Release menubar app untouched; verified live in the dev build

reviewer added 2 commits July 23, 2026 21:31
- Resolve k3/k3-agent/k2d6-agent model aliases to canonical Kimi names
- Discover sessions across all Kimi Code homes (CLI + desktop runtime)
- Accept conv-*/ctitle-* session directory naming, not just session_*
- Add Kimi Code provider tab with brand color to the menubar
- Show short model names (Kimi K3, Kimi K2.6) in the menubar payload
Read ~/.kimi-code credentials directly and poll api.kimi.com
/coding/v1/usages for the weekly quota and rate-limit windows,
mirroring the existing Codex/Claude quota services.

- New KimiSubscriptionService with lenient decoding (string/number
  values, enum-style time units, derived used from remaining) and
  429 backoff
- Quota chip on the Kimi Code tab, Plan insight, and a Kimi tab in
  Settings with connect/disconnect
- Independent refresh cadence anchor so Kimi-only setups don't poll
  on every payload tick
- Expired tokens surface as terminal with automatic recovery once
  the CLI refreshes the credential file
- Keep insights visible for quota-capable providers on empty days
- Widen Settings so six tabs don't collapse into the overflow menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant