The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): Simple mode keeps the statusbar up for a signed-out free-tier user
alt-glitch19c862020b80
diff --git a/apps/desktop/src/app/contrib/controller.tsx b/apps/desktop/src/app/contrib/controller.tsxindex 1ac6c520487..9e204d62e2e 100644--- a/apps/desktop/src/app/contrib/controller.tsx+++ b/apps/desktop/src/app/contrib/controller.tsx@@ -59,6 +59,7 @@ import { TRANSCRIPT_DIRECTIVE_AREA, type TranscriptDirectiveContribution } fromimport { setYoloEnabled } from '@/lib/yolo-session'import { $connectionsRegistry } from '@/store/connection-registry-state'import { watchDeadSessionPrune } from '@/store/dead-session-prune'+import { $freeTierSignInOpen } from '@/store/free-tier'import { $interfaceMode, $showsAdvancedChrome, setModeContext, toggleSimpleMode } from '@/store/interface-mode'import {$fileBrowserOpen,@@ -633,6 +634,8 @@ bindToolPaneCollapse(// Without the statusbar, the rail is the only way to switch profiles or gateways.$profiles.subscribe(profiles => setModeContext({ profileCount: profiles.length }))$connectionsRegistry.subscribe(registry => setModeContext({ connectionCount: registry?.connections.length ?? 0 }))+// Without the statusbar, a signed-out free-tier user would have no standing Sign in.+$freeTierSignInOpen.subscribe(open => setModeContext({ freeTierSignInOpen: open }))// ⌘K door onto the same pane the keybind and statusbar pill flip.registry.register(terminalPaletteToggle)diff --git a/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsx b/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsxindex 7cd7325d337..d565134d7f7 100644--- a/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsx+++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsx@@ -2,11 +2,14 @@ import { renderHook } from '@testing-library/react'import type { WritableAtom } from 'nanostores'import { isValidElement, type ReactNode } from 'react'import { MemoryRouter } from 'react-router'-import { afterEach, describe, expect, it, vi } from 'vitest'+import { afterAll, afterEach, describe, expect, it, vi } from 'vitest'import { group } from '@/components/pane-shell/tree/model'import { $layoutTree, noteActiveTreeGroup } from '@/components/pane-shell/tree/store'import { createClientSessionState } from '@/lib/chat-runtime'+import { $freeTierSignInOpen, $freeTierStatus } from '@/store/free-tier'+import { INTERFACE_MODES, setInterfaceMode, setModeContext } from '@/store/interface-mode'+import { $onboardingGate } from '@/store/onboarding-gate'import {$connection,$currentCwd,@@ -18,6 +21,8 @@ import {} from '@/store/session'import { $focusedTreePaneId as $focusedTreePaneIdMock } from '@/store/session-focus'import { $sessionStates, $sessionTiles } from '@/store/session-states'+import { $statusbarVisible } from '@/store/statusbar-prefs'+import type { FreeTierStatus } from '@/types/hermes'import { useStatusbarItems } from './use-statusbar-items'@@ -68,7 +73,7 @@ function focusPane(storedId: null | string): void {const wrapper = ({ children }: { children: ReactNode }) => <MemoryRouter>{children}</MemoryRouter>-function workspaceMenuIds(): string[] {+function renderStatusbarItems() {const { result } = renderHook(() =>useStatusbarItems({@@ -89,7 +94,11 @@ function workspaceMenuIds(): string[] {{ wrapper })- const workspace = result.current.leftStatusbarItems.find(item => item.id === 'workspace-cwd')+ return result.current+}++function workspaceMenuIds(): string[] {+ const workspace = renderStatusbarItems().leftStatusbarItems.find(item => item.id === 'workspace-cwd')return (workspace?.menuItems ?? []).map(item => item.id)}@@ -263,3 +272,63 @@ describe('useStatusbarItems session timer — runtime cache anchor', () => {expect(since).not.toBe(parentRowStartedAt * 1000)})})++// The statusbar chip is a free-tier user's standing way in to a sign-in, and+// an interface mode decides whether the bar is mounted at all. Whatever a mode+// rests, a signed-out free-tier user keeps one visible Sign in.+describe('free-tier Sign in in every interface mode', () => {+ const freeTier = (available: boolean): FreeTierStatus => ({+ available,+ enabled: true,+ has_guest: available,+ label: 'Nous · free tier',+ model: 'nous/welcome',+ notice_pending: false+ })++ const desktopBridge = window.hermesDesktop+ // The shell feeds the mode context from the same atom (app/contrib/controller.tsx).+ const unwire = $freeTierSignInOpen.subscribe(open => setModeContext({ freeTierSignInOpen: open }))++ function signInChipVisible(): boolean {+ const { leftStatusbarItems, statusbarItems } = renderStatusbarItems()+ const chip = [...leftStatusbarItems, ...statusbarItems].find(item => item.id === 'free-tier')++ return $statusbarVisible.get() && chip !== undefined && !chip.hidden+ }++ afterEach(() => {+ $freeTierStatus.set(null)+ $onboardingGate.set({ ...$onboardingGate.get(), phase: 'idle' })+ window.hermesDesktop = desktopBridge+ setInterfaceMode('advanced')+ })++ afterAll(() => unwire())++ it.each(INTERFACE_MODES)('shows the Sign in chip to a signed-out free-tier user in %s mode', mode => {+ setInterfaceMode(mode)+ $freeTierStatus.set(freeTier(true))++ expect(signInChipVisible()).toBe(true)+ })++ it('lets Simple rest the bar again once the user has signed in', () => {+ setInterfaceMode('simple')+ $freeTierStatus.set(freeTier(true))+ expect($statusbarVisible.get()).toBe(true)++ $freeTierStatus.set(freeTier(false))+ expect($statusbarVisible.get()).toBe(false)+ })++ it('holds the chip while a guided setup is running and brings it back after', () => {+ window.hermesDesktop = { ...desktopBridge, guestOnboardingEnabled: true } as typeof desktopBridge+ $freeTierStatus.set(freeTier(true))+ $onboardingGate.set({ ...$onboardingGate.get(), phase: 'guided' })+ expect(signInChipVisible()).toBe(false)++ $onboardingGate.set({ ...$onboardingGate.get(), phase: 'done' })+ expect(signInChipVisible()).toBe(true)+ })+})diff --git a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsxindex 77e64b918a4..55c7fe59d68 100644--- a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx+++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx@@ -39,11 +39,10 @@ import { cn } from '@/lib/utils'import { resolveVersionStatus } from '@/lib/version-status'import type { ApprovalModeRequester } from '@/store/approval-mode'import { copyFilePath, revealFile, shouldOfferLocalReveal } from '@/store/file-actions'-import { $freeTierStatus, FREE_TIER_MODEL } from '@/store/free-tier'+import { $freeTierSignInOpen, $freeTierStatus, FREE_TIER_MODEL } from '@/store/free-tier'import { openFreeTierSignIn } from '@/store/free-tier-sign-in'import { requestGatewayForProfile } from '@/store/gateway'import { revealFileInTree } from '@/store/layout'-import { $onboardingGate, guidedOnboardingActive } from '@/store/onboarding-gate'import { $activeGatewayProfile } from '@/store/profile'import { $profileRailVisible } from '@/store/profile-rail-prefs'import { $projectTree, projectNameForCwd } from '@/store/projects'@@ -159,12 +158,10 @@ export function useStatusbarItems({// Backend truth for the free-tier chip. Refreshed on the ambient status// cadence (use-status-snapshot), never polled from here.const freeTier = useStore($freeTierStatus)- // The chip is a standing invitation to sign in. During the guided first- // launch that invitation lives on the guide's own ready screen; a second- // one in the statusbar is a distraction from the chat they are in. The- // subscription is what makes the check reactive.- useStore($onboardingGate)- const guideOwnsSignIn = guidedOnboardingActive()+ // The chip is the standing invitation to sign in. It rests while a guided+ // 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 updateStatus = useStore($updateStatus)const updateApply = useStore($updateApply)const backendUpdateStatus = useStore($backendUpdateStatus)@@ -550,7 +547,7 @@ export function useStatusbarItems({// Shown while a free-tier identity exists and the tier is on: it names the// identity that carries the connectors (and inference when nothing else// does), and it is the persistent way in to the sign-in.- hidden: !freeTier?.available || guideOwnsSignIn,+ hidden: !freeTierSignInOpen,icon: <Codicon name="account" size="0.75rem" />,id: 'free-tier',label: freeTierCopy.providerName,@@ -656,9 +653,8 @@ export function useStatusbarItems({fileMenu.revealFileManager,fileMenu.revealInSidebar,offerLocalReveal,- freeTier?.available,freeTier?.model,- guideOwnsSignIn,+ freeTierSignInOpen,gatewayMenuContent,gatewayClassName,gatewayHealth,diff --git a/apps/desktop/src/store/free-tier.ts b/apps/desktop/src/store/free-tier.tsindex 42924d41193..7ea8d7820f8 100644--- a/apps/desktop/src/store/free-tier.ts+++ b/apps/desktop/src/store/free-tier.ts@@ -1,6 +1,7 @@-import { atom } from 'nanostores'+import { atom, computed } from 'nanostores'import { runFreeTierChallenge } from '@/store/free-tier-challenge'+import { $onboardingGate, guidedOnboardingActive } from '@/store/onboarding-gate'import { onboardingSurfaceActive } from '@/store/onboarding-presence'import type { FreeTierStatus } from '@/types/hermes'@@ -23,6 +24,17 @@ export type FreeTierRequester = <T = unknown>(method: string, params?: Record<st*/export const $freeTierStatus = atom<FreeTierStatus | null>(null)+/**+ * A signed-out free-tier user who should see the standing Sign in: the tier is+ * on with an identity (`available`; a sign-in replaces that identity, so it+ * reads false afterwards) and no guided setup owns the moment. The statusbar+ * chip shows on it, and Simple mode keeps the statusbar up on it.+ */+export const $freeTierSignInOpen = computed(+ [$freeTierStatus, $onboardingGate],+ status => Boolean(status?.available) && !guidedOnboardingActive()+)+function isFreeTierStatus(value: unknown): value is FreeTierStatus {return typeof value === 'object' && value !== null && typeof (value as FreeTierStatus).has_guest === 'boolean'}diff --git a/apps/desktop/src/store/interface-mode.ts b/apps/desktop/src/store/interface-mode.tsindex cba772523dd..e66930f37d8 100644--- a/apps/desktop/src/store/interface-mode.ts+++ b/apps/desktop/src/store/interface-mode.ts@@ -77,6 +77,9 @@ export function toggleSimpleMode() {/** What a policy may look at when its answer depends on the install. */export interface ModeContext {connectionCount: number+ /** A signed-out free-tier user with no setup in progress: the statusbar's+ * Sign in chip is their standing way to sign in. */+ freeTierSignInOpen: booleanprofileCount: number}@@ -111,7 +114,9 @@ const SIMPLE_POLICY: PolicyTable = {reviewOpen: false,// What was said and when — cost, tokens, PR and profile chips are readouts.sidebarRowMeta: ['preview', 'updated'],- statusbarVisible: false,+ // The bar carries the free tier's Sign in chip, the one standing way in to a+ // sign-in. It rests hidden for everyone else and goes away once they sign in.+ statusbarVisible: context => context.freeTierSignInOpen,terminalOpen: false,// Product summaries; the technical payload view is the instrumentation itself.toolViewMode: 'product'@@ -127,10 +132,14 @@ const POLICY: Record<InterfaceMode, PolicyTable> = {/** Does this mode have an opinion about the surface at all? */const shadows = (key: ModePolicyKey, mode: InterfaceMode) => key in POLICY[mode]-// The install facts a policy may consult. Fed by the app shell (profiles and gateways),+// The install facts a policy may consult. Fed by the app shell (profiles, gateways, free tier),// kept off this module's imports so preference stores can depend on it without// dragging the session graph in.-export const $modeContext = atom<ModeContext>({ connectionCount: 1, profileCount: 1 })+export const $modeContext = atom<ModeContext>({+ connectionCount: 1,+ freeTierSignInOpen: false,+ profileCount: 1+})export function setModeContext(patch: Partial<ModeContext>) {$modeContext.set({ ...$modeContext.get(), ...patch })