feat(rate-limits): add MiniMax token control (#7387)

This commit is contained in:
guihirsch
2026-07-04 23:33:25 -07:00
committed by GitHub
parent 136cb50bcb
commit f11a2109c8
46 changed files with 2889 additions and 48 deletions
+12
View File
@@ -125,3 +125,15 @@ describe('getDefaultPrimarySelectionMiddleClickPaste', () => {
expect(getDefaultPrimarySelectionMiddleClickPaste('win32')).toBe(false)
})
})
describe('MiniMax defaults', () => {
it('starts MiniMax with empty group id and the canonical default model', () => {
const settings = getDefaultSettings('/tmp')
// Why: the fetcher reads these defaults on first launch. An empty
// group id is the signal that the fetcher must pull the value from
// the cookie itself, and "general" matches the model name the
// MiniMax usage endpoint exposes by default.
expect(settings.minimaxGroupId).toBe('')
expect(settings.minimaxUsageModels).toBe('general')
})
})
+2
View File
@@ -320,6 +320,8 @@ export function getDefaultSettings(homedir: string): GlobalSettings {
defaultLinearTeamSelection: null,
opencodeSessionCookie: '',
opencodeWorkspaceId: '',
minimaxGroupId: '',
minimaxUsageModels: 'general',
geminiCliOAuthEnabled: false,
agentCmdOverrides: {},
agentDefaultArgs: { ...DEFAULT_TUI_AGENT_ARGS },
+27
View File
@@ -0,0 +1,27 @@
import { describe, expect, it } from 'vitest'
import type { RateLimitState } from './rate-limit-types'
describe('RateLimitState', () => {
it('documents the MiniMax surface used by the AccountsPane settings UI', () => {
// Why: the AccountsPane and the status bar both read these fields
// from RateLimitState. The shape must stay stable so that the
// visibility check (status-bar-provider-visibility) keeps working
// across refactors.
const state: RateLimitState = {
claude: null,
codex: null,
gemini: null,
opencodeGo: null,
kimi: null,
minimax: null,
minimaxCookieConfigured: false,
claudeTarget: { runtime: 'host', wslDistro: null },
codexTarget: { runtime: 'host', wslDistro: null },
inactiveClaudeAccounts: [],
inactiveCodexAccounts: []
}
expect(state.minimax).toBeNull()
expect(state.minimaxCookieConfigured).toBe(false)
})
})
+9 -1
View File
@@ -44,7 +44,7 @@ export type UsageRateLimitMetadata = {
}
export type ProviderRateLimits = {
provider: 'claude' | 'codex' | 'gemini' | 'opencode-go' | 'kimi'
provider: 'claude' | 'codex' | 'gemini' | 'opencode-go' | 'kimi' | 'minimax'
/** 5-hour session window, null if not available. */
session: RateLimitWindow | null
/** 7-day weekly window, null if not available. */
@@ -101,6 +101,14 @@ export type RateLimitState = {
gemini: ProviderRateLimits | null
opencodeGo: ProviderRateLimits | null
kimi: ProviderRateLimits | null
minimax: ProviderRateLimits | null
/**
* True when a MiniMax session cookie is persisted on disk. The cookie lives
* outside GlobalSettings, so this flag is the durable signal that the
* status bar uses to keep the MiniMax provider visible across reloads and
* between snapshot refreshes.
*/
minimaxCookieConfigured: boolean
claudeTarget: RateLimitRuntimeTarget
codexTarget: RateLimitRuntimeTarget
inactiveClaudeAccounts: InactiveAccountUsage[]
+1
View File
@@ -6,6 +6,7 @@ export const DEFAULT_STATUS_BAR_ITEMS: StatusBarItem[] = [
'gemini',
'opencode-go',
'kimi',
'minimax',
'ssh',
'resource-usage',
'ports'
+5
View File
@@ -2763,6 +2763,10 @@ export type GlobalSettings = {
/** Optional workspace ID override for OpenCode Go. When set, skips the
* workspaces lookup and fetches usage directly for this workspace. */
opencodeWorkspaceId: string
/** Optional MiniMax group id. When empty, the usage fetcher extracts minimax_group_id_v2 from the cookie. */
minimaxGroupId: string
/** Comma-separated MiniMax model names to show in the status bar usage window. */
minimaxUsageModels: string
/** Whether to extract OAuth credentials from the local Gemini CLI installation
* for rate-limit fetching. Disabled by default for explicit opt-in. */
geminiCliOAuthEnabled: boolean
@@ -3109,6 +3113,7 @@ export type StatusBarItem =
| 'gemini'
| 'opencode-go'
| 'kimi'
| 'minimax'
| 'ssh'
| 'resource-usage'
| 'ports'