Repository navigation
Conversation
A CLIProxyAPI hub account showed letters from its e-mail in Usage, while the model picker badges its provider instance from the instance name. One account showed two different badges. The hub keeps no name per account, so a usage limit source can now name its accounts: `accountNames` maps an e-mail to a name. The server puts the name on each hub account it reads, and the Usage chips take their letters from it with providerInstanceInitials, the function the picker uses. An account with no name keeps its e-mail letters.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A CLIProxyAPI hub account shows different letters in two places. The model picker badges a provider instance with
providerInstanceInitials(displayName), so an instance namedworkreads WO. Usage → Limits draws the same account withaccountInitials(email), the first letter before and after the@, soalice@example.comreads AE. With several hub accounts, the bars cannot be matched to the instances in the picker.A hub account has no name that could fix this. T3 reads only the file id and the e-mail from the hub's
auth-fileslist, andUsageLimitSourceConfighas no field that names hub accounts.Change
packages/contracts:UsageLimitSourceConfiggets an optionalaccountNamesmap, from e-mail to name.UsageLimitSourceAccountgets an optionaldisplayName.apps/server:UsageLimitSourcesnames each hub account from that map. The e-mail match ignores letter case. A lent last good reading takes the current name, so a renamed account does not show its old name.packages/shared: a hub account'sdisplayNamebecomes theLimitAccountname. When it merges with a native login under the driver's default name, the hub name wins. Failure notices and the composer usage label use the name too.apps/web: the account chip takes its letters from the name withproviderInstanceInitials, the function the picker uses. A named hub account keeps its chip in the bars, so the e-mail stays hidden there. The segment popover shows the name and the e-mail. The chip grows into a pill like the picker's badge (min-w-4 px-0.5instead ofsize-4), because wide pairs such as WO spilled out of the 16 px circle.apps/mobile: the same letters for a named hub account's chip.accountNameswhen the same hub is added again.An account with no name keeps today's e-mail letters. Nothing in the app writes
accountNamesyet: it is set insettings.json, for example by a script that knows which instance uses which login.{ "usageLimitSources": { "cliproxy-hub": { "kind": "cliproxy", "url": "http://127.0.0.1:8317", "managementKey": "…", "accountNames": { "alice@example.com": "work", "bob@example.com": "personal" } } } }This touches the same components as pingdotgg#40029. If that lands first, its
AccountAvataralready badges any named account withProviderInstanceIcon, and this change reduces to the name it supplies plus the chip rule.Scope
A bug fix: one account shows two different badges. The name map is the smallest change that gives a hub account a name. Matching hub accounts to provider instances on their own would need the hub and the instance to share an address, and a usage adapter in front of the hub breaks that.
Verification
apps/server/src/usage/UsageLimitSources.test.ts: a named account gets its name, the e-mail match ignores case, and an unnamed account gets none.packages/shared/src/usageLimits.test.ts: names on accounts, the merge with a default-named native login, composer labels and failure notices.apps/web/src/components/usage/UsageLimitsPooled.browser.test.tsx: chips read WO for the named account and BE for the unnamed one, and the popover shows the name and the e-mail toggle.apps/server/src/serverSettings.test.ts:accountNamesis kept on disk through a later settings patch.alice@example.comnamedwork,bob@example.comwith no name andcarol@example.comnamedpersonal.Before (main): every hub account shows e-mail letters.
After: named accounts show WO and PE, as the picker badges
workandpersonal. The unnamed account keeps BE.The segment popover of the named account: the name, and the e-mail behind its reveal toggle.
Also checked against a real hub with four Claude accounts: each bar showed the letters its instance shows in the picker.
Not checked: the mobile app on a device. It was typechecked only. Seen but not changed here: the pace tick can cross a chip when an account's bar is short, as on main.