diff --git a/CHANGELOG.md b/CHANGELOG.md index ea9c5764f0..b37630af9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Added - Agent Sessions: list and focus live local or SSH-discovered Codex and Claude Code sessions from the menu and CLI. +- Kimi K2: add a Usage Dashboard shortcut to the human-facing legacy credits page. Thanks @joeVenner! - Codex: add a provider option to hide Spark quota rows without hiding credits or other extra usage (#2013). Thanks @intellectronica! - Wayfinder: add opt-in local gateway health, routing, savings, and latency usage with configurable loopback URL support. Thanks @tcballard! - Claude CLI: surface model-scoped weekly limits alongside all-model usage without duplicating matching web limits. Thanks @janpollak! diff --git a/Sources/CodexBarCore/Providers/KimiK2/KimiK2ProviderDescriptor.swift b/Sources/CodexBarCore/Providers/KimiK2/KimiK2ProviderDescriptor.swift index 6b7a4383a3..babcb9779d 100644 --- a/Sources/CodexBarCore/Providers/KimiK2/KimiK2ProviderDescriptor.swift +++ b/Sources/CodexBarCore/Providers/KimiK2/KimiK2ProviderDescriptor.swift @@ -21,7 +21,7 @@ public enum KimiK2ProviderDescriptor { isPrimaryProvider: false, usesAccountFallback: false, browserCookieOrder: nil, - dashboardURL: nil, + dashboardURL: "https://kimrel.com/my-credits", statusPageURL: nil), branding: ProviderBranding( iconStyle: .kimi, diff --git a/Tests/CodexBarTests/MenuDescriptorKimiK2Tests.swift b/Tests/CodexBarTests/MenuDescriptorKimiK2Tests.swift new file mode 100644 index 0000000000..6aece1734b --- /dev/null +++ b/Tests/CodexBarTests/MenuDescriptorKimiK2Tests.swift @@ -0,0 +1,36 @@ +import CodexBarCore +import Testing +@testable import CodexBar + +@MainActor +@Suite(.serialized) +struct MenuDescriptorKimiK2Tests { + @Test + func `kimi K2 menu exposes the usage dashboard action`() { + let settings = testSettingsStore(suiteName: "MenuDescriptorKimiK2Tests-dashboard") + settings.statusChecksEnabled = false + settings.refreshFrequency = .manual + settings.mergeIcons = false + let store = UsageStore( + fetcher: UsageFetcher(environment: [:]), + browserDetection: BrowserDetection(cacheTTL: 0), + settings: settings) + + let descriptor = MenuDescriptor.build( + provider: .kimik2, + store: store, + settings: settings, + account: AccountInfo(email: nil, plan: nil), + updateReady: false) + let actions = descriptor.sections + .flatMap(\.entries) + .compactMap { entry -> (String, MenuDescriptor.MenuAction)? in + guard case let .action(title, action) = entry else { return nil } + return (title, action) + } + + #expect(actions.contains { title, action in + title == "Usage Dashboard" && action == .dashboard + }) + } +} diff --git a/Tests/CodexBarTests/ProviderMetadataStatusLinkTests.swift b/Tests/CodexBarTests/ProviderMetadataStatusLinkTests.swift index 3ca12b2336..9d8b59cf73 100644 --- a/Tests/CodexBarTests/ProviderMetadataStatusLinkTests.swift +++ b/Tests/CodexBarTests/ProviderMetadataStatusLinkTests.swift @@ -14,11 +14,13 @@ struct ProviderMetadataStatusLinkTests { } @Test - func `kimi K2 metadata does not present legacy endpoint as official`() throws { + func `kimi K2 metadata identifies the unofficial provider and its credits dashboard`() throws { let meta = try #require(ProviderDefaults.metadata[.kimik2]) #expect(meta.displayName == "Kimi K2 (unofficial)") #expect(meta.toggleTitle == "Show unofficial Kimi K2 usage") - #expect(meta.dashboardURL == nil) + // The dashboard URL must be a human-facing browser page, not the bearer-token + // credits API endpoint (which returns HTTP 401 to an unauthenticated browser). + #expect(meta.dashboardURL == "https://kimrel.com/my-credits") } } diff --git a/docs/kimi-k2.md b/docs/kimi-k2.md index a94beb777e..45fe2ce631 100644 --- a/docs/kimi-k2.md +++ b/docs/kimi-k2.md @@ -31,6 +31,7 @@ key for that legacy endpoint to pull your remaining balance and usage. - Credits are the billing unit; CodexBar computes used percent as `consumed / (consumed + remaining)`. - There is no explicit reset timestamp in the API, so the snapshot has no reset time. +- The menu's Usage Dashboard action opens the legacy service's human-facing credits page at `https://kimrel.com/my-credits`. - Environment variables take precedence over config. ## Key files