@@ -16,11 +16,12 @@ import { main } from '../../../wailsjs/go/models';
1616import WorkspacePageHeader from '../../components/ui/WorkspacePageHeader' ;
1717import { useDebug } from '../../context/DebugContext' ;
1818import { useI18n } from '../../context/I18nContext' ;
19- import type { SidecarStatus } from '../../types' ;
19+ import type { AccountRecord , SidecarStatus } from '../../types' ;
2020import { toErrorMessage } from '../../utils/error' ;
2121import { buildCodexDetailFrameHash , clearCodexDetailFrameHash , readFrameHashState } from '../../utils/pagePersistence' ;
2222import { hasWailsAppBindings } from '../../utils/previewMode' ;
2323import useAccountsQuotaState from '../accounts/hooks/useAccountsQuotaState' ;
24+ import useAccountsRateLimitState from '../accounts/hooks/useAccountsRateLimitState' ;
2425import useAccountsUsageState from '../accounts/hooks/useAccountsUsageState' ;
2526import { getAccountsPreviewCodexAccounts } from '../accounts/previewData' ;
2627import { mapBackendAccountRecord } from '../accounts/model/accountPresentation' ;
@@ -83,6 +84,7 @@ export default function CodexAccountListFeature({ sidecarStatus }: CodexAccountL
8384 const suppressNextDetailClickRef = useRef ( false ) ;
8485 const { codexQuotaByName, loadCodexQuotas } = useAccountsQuotaState ( trackRequest ) ;
8586 const { accountUsageByID, loadAccountUsage } = useAccountsUsageState ( trackRequest ) ;
87+ const { accountRateLimitByID, loadAccountRateLimits } = useAccountsRateLimitState ( trackRequest ) ;
8688
8789 const priorityUpdates = useMemo ( ( ) => buildCodexAccountPriorityUpdates ( orderedRows ) , [ orderedRows ] ) ;
8890 const detailRow = useMemo (
@@ -141,7 +143,7 @@ export default function CodexAccountListFeature({ sidecarStatus }: CodexAccountL
141143 const previewAccounts = getAccountsPreviewCodexAccounts ( ) ;
142144 setOrderedRows ( getCodexAccountListPreviewRows ( ) ) ;
143145 void loadCodexQuotas ( previewAccounts ) ;
144- void loadAccountUsage ( [
146+ const previewUsageAccounts : AccountRecord [ ] = [
145147 ...previewAccounts ,
146148 {
147149 id : 'openai-compatible:deepseek' ,
@@ -158,7 +160,9 @@ export default function CodexAccountListFeature({ sidecarStatus }: CodexAccountL
158160 status : 'disabled' ,
159161 disabled : true ,
160162 } ,
161- ] ) ;
163+ ] ;
164+ void loadAccountUsage ( previewUsageAccounts ) ;
165+ void loadAccountRateLimits ( previewUsageAccounts ) ;
162166 setMessage ( messageOverride || t ( 'codex.account_list_preview_loaded' ) ) ;
163167 return ;
164168 }
@@ -183,6 +187,7 @@ export default function CodexAccountListFeature({ sidecarStatus }: CodexAccountL
183187 } ) ;
184188 void loadCodexQuotas ( accountRows ) ;
185189 void loadAccountUsage ( accountRows ) ;
190+ void loadAccountRateLimits ( nextRows . map ( ( row ) => codexRowToAccountRecord ( row ) ) ) ;
186191 setOrderedRows ( nextRows ) ;
187192 setMessage ( messageOverride || t ( 'codex.account_list_loaded' ) ) ;
188193 } catch ( error ) {
@@ -195,7 +200,7 @@ export default function CodexAccountListFeature({ sidecarStatus }: CodexAccountL
195200
196201 useEffect ( ( ) => {
197202 void reload ( ) ;
198- } , [ browserMode , loadAccountUsage , loadCodexQuotas , ready ] ) ;
203+ } , [ browserMode , loadAccountRateLimits , loadAccountUsage , loadCodexQuotas , ready ] ) ;
199204
200205 useEffect ( ( ) => {
201206 if ( routingProbeModel . trim ( ) ) {
@@ -684,7 +689,7 @@ export default function CodexAccountListFeature({ sidecarStatus }: CodexAccountL
684689
685690 return (
686691 < div className = "h-full w-full overflow-auto p-6 lg:p-8" data-collaboration-id = "PAGE_CODEX_ACCOUNT_LIST" >
687- < div className = "mx-auto w-full max-w-6xl min-w-[72rem] space-y-8" >
692+ < div className = "mx-auto w-full max-w-6xl min-w-0 space-y-8" >
688693 < WorkspacePageHeader
689694 title = { t ( 'codex.account_list_title' ) }
690695 subtitle = { t ( 'codex.account_list_subtitle' ) }
@@ -730,6 +735,7 @@ export default function CodexAccountListFeature({ sidecarStatus }: CodexAccountL
730735 routePolicyRowStates = { routePolicyRowStates }
731736 codexQuotaByName = { codexQuotaByName }
732737 accountUsageByID = { accountUsageByID }
738+ accountRateLimitByID = { accountRateLimitByID }
733739 refreshLabel = { t ( 'common.refresh' ) }
734740 loadingLabel = { t ( 'common.loading' ) }
735741 saveLabel = { t ( 'codex.account_list_save_order' ) }
@@ -784,3 +790,17 @@ function filterCodexAccountIDs(previous: string[], availableIDs: string[]) {
784790 const available = new Set ( availableIDs ) ;
785791 return normalizeCodexAccountIDList ( previous ) . filter ( ( id ) => available . has ( id ) ) ;
786792}
793+
794+ function codexRowToAccountRecord ( row : CodexAccountRow ) : AccountRecord {
795+ return {
796+ id : row . id ,
797+ provider : row . provider ,
798+ credentialSource : row . sourceKind === 'codex-auth-file' ? 'auth-file' : 'api-key' ,
799+ displayName : row . label ,
800+ status : row . status ,
801+ disabled : row . disabled ,
802+ baseUrl : row . baseUrl ,
803+ quotaKey : row . quotaKey ,
804+ name : row . id . startsWith ( 'auth-file:' ) ? row . id . slice ( 'auth-file:' . length ) : undefined ,
805+ } ;
806+ }
0 commit comments