🤯 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
💄 style(subscription-accounts): split the list into Workspace and Private tabs (#23250)
Rdmclin28ed24956dee6
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.jsonindex c2f1ed60b62..707fd4f7a45 100644--- a/locales/en-US/setting.json+++ b/locales/en-US/setting.json@@ -2218,7 +2218,9 @@"subscriptionAccounts.columns.rotation": "Balancing","subscriptionAccounts.columns.status": "Status","subscriptionAccounts.empty.desc": "Sign in to Claude Code, Codex or Kimi Code on a connected device. The account appears here once it reports its quota.",+ "subscriptionAccounts.empty.privateDesc": "No private accounts here. Accounts you sign in to on your devices start here, visible only to you.","subscriptionAccounts.empty.title": "No subscription accounts yet",+ "subscriptionAccounts.empty.workspaceDesc": "No accounts are shared with this workspace yet. Share one from the Private tab so teammates' agents can use it.","subscriptionAccounts.filter.all": "All","subscriptionAccounts.filterEmpty": "No account matches the filter.","subscriptionAccounts.loadFailed": "Couldn't load subscription accounts",@@ -2234,15 +2236,18 @@"subscriptionAccounts.status.exhaustedNoReset": "Used up","subscriptionAccounts.status.noData": "No quota reported yet","subscriptionAccounts.summary": "{{inRotation}} of {{count}} in rotation",+ "subscriptionAccounts.tabs.private": "Private",+ "subscriptionAccounts.tabs.workspace": "Workspace","subscriptionAccounts.updateFailed": "Couldn't update the account. Try again.","subscriptionAccounts.usageTitle": "Usage history",- "subscriptionAccounts.visibility.private": "Private","subscriptionAccounts.visibility.privateAction": "Make private","subscriptionAccounts.visibility.privateConfirm.desc": "Only you will see it. Other members' agents stop drawing on its quota.","subscriptionAccounts.visibility.privateConfirm.title": "Make this account private?",+ "subscriptionAccounts.visibility.privateDone": "Made private. It now lists under Private.","subscriptionAccounts.visibility.publicAction": "Share with workspace","subscriptionAccounts.visibility.publicConfirm.desc": "Every member will see it, and their agents can draw on its quota. You can make it private again from the same menu.","subscriptionAccounts.visibility.publicConfirm.title": "Share this account with the workspace?",+ "subscriptionAccounts.visibility.publicDone": "Shared. It now lists under Workspace.","sync.device.deviceName.hint": "Add a name for easy identification","sync.device.deviceName.placeholder": "Enter device name","sync.device.deviceName.title": "Device Name",diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.jsonindex 426b9e4b08c..e888da6a44d 100644--- a/locales/zh-CN/setting.json+++ b/locales/zh-CN/setting.json@@ -2218,7 +2218,9 @@"subscriptionAccounts.columns.rotation": "参与分配","subscriptionAccounts.columns.status": "状态","subscriptionAccounts.empty.desc": "在已连接的设备上登录 Claude Code、Codex 或 Kimi Code,账号上报额度后会出现在这里。",+ "subscriptionAccounts.empty.privateDesc": "这里还没有你的私人账号。你在设备上登录的账号会先出现在这里,只有你能看到。","subscriptionAccounts.empty.title": "还没有订阅账号",+ "subscriptionAccounts.empty.workspaceDesc": "还没有共享到工作区的账号。在「私人」里把账号共享出来,团队成员的 Agent 就能使用它。","subscriptionAccounts.filter.all": "全部","subscriptionAccounts.filterEmpty": "没有符合筛选条件的账号","subscriptionAccounts.loadFailed": "订阅账号加载失败",@@ -2234,15 +2236,18 @@"subscriptionAccounts.status.exhaustedNoReset": "已用尽","subscriptionAccounts.status.noData": "暂无额度数据","subscriptionAccounts.summary": "共 {{count}} 个账号 · {{inRotation}} 个参与分配",+ "subscriptionAccounts.tabs.private": "私人",+ "subscriptionAccounts.tabs.workspace": "工作区","subscriptionAccounts.updateFailed": "账号更新失败,请重试","subscriptionAccounts.usageTitle": "用量记录",- "subscriptionAccounts.visibility.private": "私有",- "subscriptionAccounts.visibility.privateAction": "设为私有",+ "subscriptionAccounts.visibility.privateAction": "设为私人","subscriptionAccounts.visibility.privateConfirm.desc": "之后只有你能看到它,其他成员的 Agent 不再使用它的额度。",- "subscriptionAccounts.visibility.privateConfirm.title": "将这个账号设为私有?",- "subscriptionAccounts.visibility.publicAction": "共享给团队",- "subscriptionAccounts.visibility.publicConfirm.desc": "所有成员都能看到它,他们的 Agent 也可以使用它的额度。之后可以在同一菜单里改回私有。",- "subscriptionAccounts.visibility.publicConfirm.title": "将这个账号共享给团队?",+ "subscriptionAccounts.visibility.privateConfirm.title": "将这个账号设为私人?",+ "subscriptionAccounts.visibility.privateDone": "已设为私人,账号移到了「私人」。",+ "subscriptionAccounts.visibility.publicAction": "共享到工作区",+ "subscriptionAccounts.visibility.publicConfirm.desc": "工作区所有成员都能看到它,他们的 Agent 也可以使用它的额度。之后可以在同一菜单里改回私人。",+ "subscriptionAccounts.visibility.publicConfirm.title": "将这个账号共享到工作区?",+ "subscriptionAccounts.visibility.publicDone": "已共享,账号移到了「工作区」。","sync.device.deviceName.hint": "添加名称以便于识别","sync.device.deviceName.placeholder": "请输入设备名称","sync.device.deviceName.title": "设备名称",diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.tsindex 43977637f2e..50ca45b26cd 100644--- a/packages/locales/src/default/setting.ts+++ b/packages/locales/src/default/setting.ts@@ -5166,7 +5166,11 @@ When I am ___, I need ___'subscriptionAccounts.columns.status': 'Status','subscriptionAccounts.empty.desc':'Sign in to Claude Code, Codex or Kimi Code on a connected device. The account appears here once it reports its quota.',+ 'subscriptionAccounts.empty.privateDesc':+ 'No private accounts here. Accounts you sign in to on your devices start here, visible only to you.','subscriptionAccounts.empty.title': 'No subscription accounts yet',+ 'subscriptionAccounts.empty.workspaceDesc':+ "No accounts are shared with this workspace yet. Share one from the Private tab so teammates' agents can use it.",'subscriptionAccounts.filter.all': 'All','subscriptionAccounts.loadFailed': "Couldn't load subscription accounts",'subscriptionAccounts.meter.session': '5-hour',@@ -5208,17 +5212,20 @@ When I am ___, I need ___'subscriptionAccounts.calendar.todayDay': 'Today','subscriptionAccounts.calendar.tomorrow': 'Tomorrow {{time}}','subscriptionAccounts.calendar.tomorrowDay': 'Tomorrow',+ 'subscriptionAccounts.tabs.private': 'Private',+ 'subscriptionAccounts.tabs.workspace': 'Workspace','subscriptionAccounts.summary': '{{inRotation}} of {{count}} in rotation','subscriptionAccounts.updateFailed': "Couldn't update the account. Try again.",- 'subscriptionAccounts.visibility.private': 'Private','subscriptionAccounts.visibility.privateAction': 'Make private','subscriptionAccounts.visibility.privateConfirm.desc':"Only you will see it. Other members' agents stop drawing on its quota.",'subscriptionAccounts.visibility.privateConfirm.title': 'Make this account private?',+ 'subscriptionAccounts.visibility.privateDone': 'Made private. It now lists under Private.','subscriptionAccounts.visibility.publicAction': 'Share with workspace','subscriptionAccounts.visibility.publicConfirm.desc':'Every member will see it, and their agents can draw on its quota. You can make it private again from the same menu.','subscriptionAccounts.visibility.publicConfirm.title': 'Share this account with the workspace?',+ 'subscriptionAccounts.visibility.publicDone': 'Shared. It now lists under Workspace.','tab.subscriptionAccounts': 'Subscription Accounts','taskLabels.actions.addToGroup': 'Add label to group','taskLabels.actions.create': 'New label',diff --git a/src/features/SubscriptionAccounts/AccountRow.tsx b/src/features/SubscriptionAccounts/AccountRow.tsxindex 14039a5ec93..515015a86ed 100644--- a/src/features/SubscriptionAccounts/AccountRow.tsx+++ b/src/features/SubscriptionAccounts/AccountRow.tsx@@ -216,11 +216,8 @@ const AccountRow = ({ account, active, onOpen }: AccountRowProps) => {// Only workspace accounts carry a visibility; personal ones have no team to hide from.const isPrivate = !!account.workspaceId && account.visibility === 'private';// With a label set, the email moves to the subtitle so the account stays identifiable.- const subtitle = [- meta.name,- account.label ? account.email : undefined,- isPrivate ? t('subscriptionAccounts.visibility.private') : undefined,- ]+ // Private or shared is the page's tab, so the row does not repeat it.+ const subtitle = [meta.name, account.label ? account.email : undefined].filter(Boolean).join(' · ');@@ -256,7 +253,9 @@ const AccountRow = ({ account, active, onOpen }: AccountRowProps) => {okButtonProps: visibility === 'private' ? { danger: true } : undefined,okText: t(`subscriptionAccounts.visibility.${visibility}Action`),onOk: async () => {- await run(() => setQuotaAccountVisibility(account.id, visibility));+ // The account leaves this tab, so say where it went.+ if (await run(() => setQuotaAccountVisibility(account.id, visibility)))+ toast.success(t(`subscriptionAccounts.visibility.${visibility}Done`));},title: t(`subscriptionAccounts.visibility.${visibility}Confirm.title`),});diff --git a/src/features/SubscriptionAccounts/accountView.test.ts b/src/features/SubscriptionAccounts/accountView.test.tsindex 72d94f13cd5..2497052b136 100644--- a/src/features/SubscriptionAccounts/accountView.test.ts+++ b/src/features/SubscriptionAccounts/accountView.test.ts@@ -1,6 +1,12 @@import { describe, expect, it } from 'vitest';-import { deriveAccountView, matchesKeyword, meterWindows, sortAccounts } from './accountView';+import {+ accountVisibilityTab,+ deriveAccountView,+ matchesKeyword,+ meterWindows,+ sortAccounts,+} from './accountView';const NOW = Date.UTC(2026, 9, 24, 12);const HOUR = 60 * 60 * 1000;@@ -148,3 +154,15 @@ describe('matchesKeyword', () => {expect(matchesKeyword(ultra, 'max')).toBe(false);});});++describe('accountVisibilityTab', () => {+ it('lists a private account under Private and a shared one under Workspace', () => {+ expect(accountVisibilityTab({ visibility: 'private' })).toBe('private');+ expect(accountVisibilityTab({ visibility: 'public' })).toBe('public');+ });++ it('lists an account without a stored visibility under Workspace', () => {+ expect(accountVisibilityTab({ visibility: null })).toBe('public');+ expect(accountVisibilityTab({})).toBe('public');+ });+});diff --git a/src/features/SubscriptionAccounts/accountView.ts b/src/features/SubscriptionAccounts/accountView.tsindex 836b5a30a5c..396532604cd 100644--- a/src/features/SubscriptionAccounts/accountView.ts+++ b/src/features/SubscriptionAccounts/accountView.ts@@ -152,3 +152,15 @@ export const matchesKeyword = (field?.toLowerCase().includes(needle),);};++/** The two pools of a workspace, as tabs: shared with every member, or the caller's own. */+export type AccountVisibilityTab = 'private' | 'public';++/**+ * Which workspace tab an account lists under. A teammate's private account is+ * never returned to the caller, so the Private tab holds only the caller's own.+ * A personal-space account has no team and no visibility: it is not split.+ */+export const accountVisibilityTab = (account: {+ visibility?: string | null;+}): AccountVisibilityTab => (account.visibility === 'private' ? 'private' : 'public');diff --git a/src/features/SubscriptionAccounts/index.tsx b/src/features/SubscriptionAccounts/index.tsxindex 9ee36c932af..15217285c91 100644--- a/src/features/SubscriptionAccounts/index.tsx+++ b/src/features/SubscriptionAccounts/index.tsx@@ -1,11 +1,23 @@'use client';-import { ActionIcon, Button, Empty, Flexbox, SearchBar, Select, Text } from '@lobehub/ui';+import {+ ActionIcon,+ Button,+ Empty,+ Flexbox,+ Icon,+ SearchBar,+ Select,+ Tabs,+ Text,+} from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';-import { RefreshCwIcon } from 'lucide-react';+import { LockIcon, RefreshCwIcon, UsersIcon } from 'lucide-react';import { useState } from 'react';import { useTranslation } from 'react-i18next';+import { useSearchParams } from 'react-router';+import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';import SkeletonBar from '@/components/Skeleton/Bar';import { cacheScope } from '@/libs/replica';import { agentQuotaSelectors, type QuotaAccount, useAgentQuotaStore } from '@/store/agentQuota';@@ -13,6 +25,8 @@ import { agentQuotaSelectors, type QuotaAccount, useAgentQuotaStore } from '@/stimport AccountDetailPanel from './AccountDetailPanel';import AccountRow, { AccountListHeader, LIST_MIN_WIDTH, PROVIDER_NAME } from './AccountRow';import {+ type AccountVisibilityTab,+ accountVisibilityTab,isSubscriptionProvider,matchesKeyword,sortAccounts,@@ -30,6 +44,10 @@ const ALL = 'all';* list with their live quota — the shared capacity agents are balanced onto.* Accounts register themselves when a CLI login reports quota; this page only* decides which of them stay in rotation and what they are called.+ *+ * In a workspace the accounts split into two tabs, as on the Devices page:+ * Workspace (shared with every member) and Private (the caller's own). The tab+ * lives in `?visibility=`; the personal space has no team and no tabs.*/const SubscriptionAccounts = () => {const { t } = useTranslation('setting');@@ -43,10 +61,30 @@ const SubscriptionAccounts = () => {const [provider, setProvider] = useState<SubscriptionProvider | typeof ALL>(ALL);const [keyword, setKeyword] = useState('');const [openId, setOpenId] = useState<string>();+ const split = !!useActiveWorkspaceId();+ const [searchParams, setSearchParams] = useSearchParams();+ const tab: AccountVisibilityTab =+ searchParams.get('visibility') === 'private' ? 'private' : 'public';+ const setTab = (next: AccountVisibilityTab) => {+ // The open account belongs to the tab being left.+ setOpenId(undefined);+ // Keep the other params (e.g. `?hl=`); only the tab changes.+ setSearchParams(+ (prev) => {+ const params = new URLSearchParams(prev);+ if (next === 'private') params.set('visibility', next);+ else params.delete('visibility');+ return params;+ },+ { replace: true },+ );+ };- const accounts = sortAccounts(+ const allAccounts = sortAccounts((loaded ?? []).filter((a): a is ProviderAccount => isSubscriptionProvider(a.provider)),);+ // Everything below (filters, counts, capacity, the open account) speaks for the active tab.+ const accounts = split ? allAccounts.filter((a) => accountVisibilityTab(a) === tab) : allAccounts;const present = SUBSCRIPTION_PROVIDERS.filter((p) => accounts.some((a) => a.provider === p));// A provider filter that no longer has accounts falls back to everything.const active = provider !== ALL && present.includes(provider) ? provider : ALL;@@ -71,7 +109,7 @@ const SubscriptionAccounts = () => {};// A hydrated empty list may be stale: only the server's answer settles "none yet".- const settling = !confirmed && !error && accounts.length === 0;+ const settling = !confirmed && !error && allAccounts.length === 0;const body = settling ? (<Flexbox gap={4}>@@ -79,18 +117,28 @@ const SubscriptionAccounts = () => {<SkeletonBar height={56} key={i} radius={cssVar.borderRadius} />))}</Flexbox>- ) : error && accounts.length === 0 ? (+ ) : error && allAccounts.length === 0 ? (// A failed load must not read as "no accounts" — they would look identical.<Flexbox align={'center'} gap={12} paddingBlock={40}><Empty description={t('subscriptionAccounts.loadFailed')} /><Button onClick={() => void revalidate()}>{t('retry', { ns: 'common' })}</Button></Flexbox>- ) : accounts.length === 0 ? (+ ) : allAccounts.length === 0 ? (<Emptydescription={t('subscriptionAccounts.empty.desc')}style={{ paddingBlock: 40 }}title={t('subscriptionAccounts.empty.title')}/>+ ) : accounts.length === 0 ? (+ // The other tab has accounts: say what belongs here and how one gets here.+ <Empty+ style={{ paddingBlock: 40 }}+ description={+ tab === 'private'+ ? t('subscriptionAccounts.empty.privateDesc')+ : t('subscriptionAccounts.empty.workspaceDesc')+ }+ />) : (<Flexbox gap={16}>{visible.length > 0 && (@@ -120,40 +168,74 @@ const SubscriptionAccounts = () => {</Flexbox>);+ const summary = (+ <Text fontSize={13} type={'secondary'}>+ {accounts.length > 0 &&+ t('subscriptionAccounts.summary', { count: accounts.length, inRotation })}+ </Text>+ );+return (<Flexbox gap={16} width={'100%'}>+ {/* Tabs, the summary beside them, and the toolbar share one row, as on the+ Devices page. The tabs sit in a plain block (as there): a flex wrapper+ stretches their full-width root and throws the row out of line. */}<Flexbox horizontal align={'center'} gap={12} justify={'space-between'} wrap={'wrap'}>- <Text fontSize={13} type={'secondary'}>- {accounts.length > 0 &&- t('subscriptionAccounts.summary', { count: accounts.length, inRotation })}- </Text>- {/* Filters sit on the right as a dropdown: the provider list grows with- every coding plan we support, which a segmented control cannot hold. */}+ <Flexbox horizontal align={'center'} gap={16} style={{ minWidth: 0 }}>+ {split && (+ <div style={{ flex: 'none' }}>+ <Tabs+ activeKey={tab}+ items={[+ {+ icon: <Icon icon={UsersIcon} />,+ key: 'public',+ label: t('subscriptionAccounts.tabs.workspace'),+ },+ {+ icon: <Icon icon={LockIcon} />,+ key: 'private',+ label: t('subscriptionAccounts.tabs.private'),+ },+ ]}+ onChange={(key) => setTab(key as AccountVisibilityTab)}+ />+ </div>+ )}+ {summary}+ </Flexbox><Flexbox horizontal align={'center'} gap={8}>- <SearchBar- allowClear- placeholder={t('subscriptionAccounts.searchPlaceholder')}- style={{ width: 240 }}- value={keyword}- variant={'filled'}- onChange={(e) => setKeyword(e.target.value)}- />- <Select- style={{ minWidth: 168 }}- value={active}- variant={'filled'}- options={[- {- label: `${t('subscriptionAccounts.filter.all')} · ${accounts.length}`,- value: ALL,- },- ...present.map((p) => ({- label: `${PROVIDER_NAME[p]} · ${accounts.filter((a) => a.provider === p).length}`,- value: p,- })),- ]}- onChange={(value) => setProvider(value as SubscriptionProvider | typeof ALL)}- />+ {/* Nothing to search or filter in an empty tab. Filters sit on the right+ as a dropdown: the provider list grows with every coding plan we+ support, which a segmented control cannot hold. */}+ {accounts.length > 0 && (+ <>+ <SearchBar+ allowClear+ placeholder={t('subscriptionAccounts.searchPlaceholder')}+ style={{ width: 240 }}+ value={keyword}+ variant={'filled'}+ onChange={(e) => setKeyword(e.target.value)}+ />+ <Select+ style={{ minWidth: 168 }}+ value={active}+ variant={'filled'}+ options={[+ {+ label: `${t('subscriptionAccounts.filter.all')} · ${accounts.length}`,+ value: ALL,+ },+ ...present.map((p) => ({+ label: `${PROVIDER_NAME[p]} · ${accounts.filter((a) => a.provider === p).length}`,+ value: p,+ })),+ ]}+ onChange={(value) => setProvider(value as SubscriptionProvider | typeof ALL)}+ />+ </>+ )}<ActionIconicon={RefreshCwIcon}loading={isValidating || refreshing}