π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π fix(quota): show a Max 20x Claude account as Ultra (#22180)
Rdmclin2e7d307f76a91
diff --git a/packages/heterogeneous-agents/src/quota/index.ts b/packages/heterogeneous-agents/src/quota/index.tsindex bacd972077a..fd163707457 100644--- a/packages/heterogeneous-agents/src/quota/index.ts+++ b/packages/heterogeneous-agents/src/quota/index.ts@@ -4,6 +4,7 @@ export * from './codex';export * from './cost';export * from './kimiCode';export * from './loadBalancer';+export * from './plan';export * from './readings';export * from './snapshot';export * from './types';diff --git a/packages/heterogeneous-agents/src/quota/plan.test.ts b/packages/heterogeneous-agents/src/quota/plan.test.tsnew file mode 100644index 00000000000..ba0ee3c7ef2--- /dev/null+++ b/packages/heterogeneous-agents/src/quota/plan.test.ts@@ -0,0 +1,33 @@+import { describe, expect, it } from 'vitest';++import { displayPlanTier } from './plan';++describe('displayPlanTier', () => {+ it('shows a Max 20x account as Ultra, the name it was migrated to', () => {+ expect(displayPlanTier({ planTier: 'max', rateLimitTier: 'default_claude_max_20x' })).toBe(+ 'ultra',+ );+ });++ it('keeps the $100 Max 5x plan as Max', () => {+ expect(displayPlanTier({ planTier: 'max', rateLimitTier: 'default_claude_max_5x' })).toBe(+ 'max',+ );+ });++ it('passes other plans through, including one that already reports ultra', () => {+ expect(displayPlanTier({ planTier: 'ultra', rateLimitTier: 'default_claude_ultra' })).toBe(+ 'ultra',+ );+ expect(displayPlanTier({ planTier: 'pro', rateLimitTier: null })).toBe('pro');+ expect(displayPlanTier({ planTier: 'max' })).toBe('max');+ // Codex reports its own plan names and no rate-limit tier.+ expect(displayPlanTier({ planTier: 'plus' })).toBe('plus');+ });++ it('shows nothing before the account reports a plan', () => {+ expect(displayPlanTier({ planTier: null, rateLimitTier: 'default_claude_max_20x' })).toBe(+ undefined,+ );+ });+});diff --git a/packages/heterogeneous-agents/src/quota/plan.ts b/packages/heterogeneous-agents/src/quota/plan.tsnew file mode 100644index 00000000000..346746a4c8b--- /dev/null+++ b/packages/heterogeneous-agents/src/quota/plan.ts@@ -0,0 +1,24 @@+interface PlanFields {+ planTier?: string | null;+ rateLimitTier?: string | null;+}++/** The rate-limit tier of the $200 plan formerly sold as Max 20x. */+const ULTRA_RATE_LIMIT_TIER = /(?:^|_)max_20x$/i;++/**+ * The plan name to show for a subscription account.+ *+ * Anthropic renamed Max 20x to Ultra on 2026-10-30 and moved existing+ * subscribers over automatically, but the account record Claude Code caches+ * still says `organizationType: claude_max` for them. Only the rate-limit tier+ * (`default_claude_max_20x` vs `default_claude_max_5x`) tells the $200 plan+ * from the $100 one, so read the plan through it. Anything else, including a+ * plan that already reports `ultra`, passes through unchanged.+ */+export const displayPlanTier = ({ planTier, rateLimitTier }: PlanFields): string | undefined => {+ if (!planTier) return undefined;+ if (planTier === 'max' && rateLimitTier && ULTRA_RATE_LIMIT_TIER.test(rateLimitTier))+ return 'ultra';+ return planTier;+};diff --git a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountManagerModal.tsx b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountManagerModal.tsxindex 056b29ab77a..7560c1bd7a9 100644--- a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountManagerModal.tsx+++ b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountManagerModal.tsx@@ -1,7 +1,11 @@'use client';import { isDesktop } from '@lobechat/const';-import { currentUtilization, isWeeklyAllLimit } from '@lobechat/heterogeneous-agents/quota';+import {+ currentUtilization,+ displayPlanTier,+ isWeeklyAllLimit,+} from '@lobechat/heterogeneous-agents/quota';import {ActionIcon,Button,@@ -509,7 +513,7 @@ const QuotaAccountManager = memo<QuotaAccountManagerProps>(({ agentId, deviceId</Text>{a.planTier && (<Text style={{ flex: 'none', fontSize: 12 }} type={'secondary'}>- {a.planTier}+ {displayPlanTier(a)}</Text>)}</Flexbox>diff --git a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountSwitcher.tsx b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountSwitcher.tsxindex 6207d669170..b79ba2c2842 100644--- a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountSwitcher.tsx+++ b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountSwitcher.tsx@@ -1,6 +1,6 @@'use client';-import type { QuotaAccountIdentity } from '@lobechat/heterogeneous-agents/quota';+import { displayPlanTier, type QuotaAccountIdentity } from '@lobechat/heterogeneous-agents/quota';import { ActionIcon, Button, Flexbox, Text, usePopoverContext } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';@@ -69,7 +69,7 @@ const QuotaAccountSwitcher = memo<{</Text>{identity?.planTier && (<Text style={{ flex: 'none', fontSize: 12 }} type={'secondary'}>- {identity.planTier}+ {displayPlanTier(identity)}</Text>)}<ActionIcondiff --git a/src/features/SubscriptionAccounts/AccountRow.tsx b/src/features/SubscriptionAccounts/AccountRow.tsxindex abfa88a6621..8e0033538e7 100644--- a/src/features/SubscriptionAccounts/AccountRow.tsx+++ b/src/features/SubscriptionAccounts/AccountRow.tsx@@ -1,5 +1,6 @@'use client';+import { displayPlanTier } from '@lobechat/heterogeneous-agents/quota';import { ClaudeCode, Codex, Kimi } from '@lobehub/icons';import {ActionIcon,@@ -187,6 +188,7 @@ const AccountRow = ({ account, active, onOpen }: AccountRowProps) => {const view = deriveAccountView(account, readings, Date.now());const meta = PROVIDER_META[account.provider];const name = accountDisplayName(account);+ const plan = displayPlanTier(account);// With a label set, the email moves to the subtitle so the account stays identifiable.const subtitle = [meta.name, account.label ? account.email : undefined].filter(Boolean)@@ -311,9 +313,9 @@ const AccountRow = ({ account, active, onOpen }: AccountRowProps) => {ellipsisfontSize={13}style={{ flex: 'none', width: COLUMN_WIDTH.plan }}- type={account.planTier ? undefined : 'secondary'}+ type={plan ? undefined : 'secondary'}>- {account.planTier || 'β'}+ {plan || 'β'}</Text><Flexboxdiff --git a/src/features/SubscriptionAccounts/accountView.test.ts b/src/features/SubscriptionAccounts/accountView.test.tsindex 1ce5c1b316d..710e6a29a3c 100644--- a/src/features/SubscriptionAccounts/accountView.test.ts+++ b/src/features/SubscriptionAccounts/accountView.test.ts@@ -115,4 +115,11 @@ describe('matchesKeyword', () => {expect(matchesKeyword(account, ' ')).toBe(true);expect(matchesKeyword(account, 'codex')).toBe(false);});++ it('finds a Max 20x account by the Ultra name it is shown under', () => {+ const ultra = { planTier: 'max', rateLimitTier: 'default_claude_max_20x' };++ expect(matchesKeyword(ultra, 'ultra')).toBe(true);+ expect(matchesKeyword(ultra, 'max')).toBe(false);+ });});diff --git a/src/features/SubscriptionAccounts/accountView.ts b/src/features/SubscriptionAccounts/accountView.tsindex 4a382f07700..c865c91d904 100644--- a/src/features/SubscriptionAccounts/accountView.ts+++ b/src/features/SubscriptionAccounts/accountView.ts@@ -1,4 +1,5 @@import {+ displayPlanTier,isSessionLimit,isWeeklyAllLimit,type QuotaDisplayReading,@@ -125,12 +126,17 @@ export const sortAccounts = </** Whether an account matches the search box: name, email or plan, case-insensitive. */export const matchesKeyword = (- account: { email?: string | null; label?: string | null; planTier?: string | null },+ account: {+ email?: string | null;+ label?: string | null;+ planTier?: string | null;+ rateLimitTier?: string | null;+ },keyword: string,): boolean => {const needle = keyword.trim().toLowerCase();if (!needle) return true;- return [account.label, account.email, account.planTier].some((field) =>+ return [account.label, account.email, displayPlanTier(account)].some((field) =>field?.toLowerCase().includes(needle),);};