Skip to content

The agent that grows with you

refactor(desktop): name the trial model once so the statusbar items stay under the complexity cap

alt-glitch2ae47b3775e1
diff --git a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx
index 20a6829c30e..f1ca004ec67 100644
--- a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx
+++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx
@@ -77,7 +77,7 @@ import {
$updateStatus,
openUpdateOverlayFor
} from '@/store/updates'
-import type { StatusResponse, UsageStats } from '@/types/hermes'
+import type { FreeTierStatus, StatusResponse, UsageStats } from '@/types/hermes'
import { CRON_ROUTE, SETTINGS_ROUTE, WEBHOOKS_ROUTE } from '../../routes'
import type { StatusbarItem } from '../statusbar-controls'
@@ -124,6 +124,11 @@ function versionItem(
}
}
+/** The free model a trial runs on, named on the Sign in chip; null for a guest without the trial. */
+function freeTierTrialModel(status: FreeTierStatus | null): string | null {
+ return status?.available ? status.model || FREE_TIER_MODEL : null
+}
+
// health: allow CC FUNC_LINES -- usage-window plans: one status-bar gauge item, hidden for every other account; this hook was over both targets on main
export function useStatusbarItems({
agentsOpen,
@@ -192,6 +197,7 @@ export function useStatusbarItems({
// setup is running, so the chat the user is in has no second call to action,
// and comes back when the setup ends.
const freeTierSignInOpen = useStore($freeTierSignInOpen)
+ const trialModel = freeTierTrialModel(freeTier)
const updateStatus = useStore($updateStatus)
const updateApply = useStore($updateApply)
const backendUpdateStatus = useStore($backendUpdateStatus)
@@ -525,11 +531,7 @@ export function useStatusbarItems({
// solid and set off by a gap instead of touching the label.
detail: (
<span className="inline-flex items-center gap-2">
- {freeTier?.available && (
- <span className="font-mono text-[0.625rem] text-muted-foreground/70">
- {freeTier.model || FREE_TIER_MODEL}
- </span>
- )}
+ {trialModel && <span className="font-mono text-[0.625rem] text-muted-foreground/70">{trialModel}</span>}
{/* The class merger drops Badge's own leading-none behind the size's
font-size class, so the badge grows to the inherited 1.5 leading and
overhangs an 11px label. Restating it here keeps it 11.6px tall. */}
@@ -538,15 +540,14 @@ export function useStatusbarItems({
</Badge>
</span>
),
- // Shown while a guest identity exists (the trial, or connected apps without
- // it): it names the identity that carries the connectors (and inference on
- // the trial), and it is the persistent way in to the sign-in.
+ // Shown while a guest identity exists (the trial, or apps without it): the
+ // identity carrying the connectors, and the persistent way in to the sign-in.
hidden: !freeTierSignInOpen,
icon: <Codicon name="account" size="0.75rem" />,
id: 'free-tier',
label: freeTierCopy.providerName,
onSelect: () => openFreeTierSignIn(),
- title: freeTier?.available ? freeTierCopy.statusLabel(freeTier.model || FREE_TIER_MODEL) : freeTierCopy.providerName,
+ title: trialModel ? freeTierCopy.statusLabel(trialModel) : freeTierCopy.providerName,
toggleLabel: copy.toggleFreeTier,
variant: 'action'
},
@@ -649,8 +650,7 @@ export function useStatusbarItems({
fileMenu.revealFileManager,
fileMenu.revealInSidebar,
offerLocalReveal,
- freeTier?.available,
- freeTier?.model,
+ trialModel,
freeTierSignInOpen,
gatewayMenuContent,
gatewayClassName,