Skip to content

The agent that grows with you

feat(desktop): Skip setup, the local-model offer after onboarding, Run onboarding again

alt-glitch232f5c486bb6
diff --git a/apps/desktop/src/app/chat/composer/index.tsx b/apps/desktop/src/app/chat/composer/index.tsx
index 1127f41f64d..b0677d8bc7e 100644
--- a/apps/desktop/src/app/chat/composer/index.tsx
+++ b/apps/desktop/src/app/chat/composer/index.tsx
@@ -14,6 +14,7 @@ import {
import { useTourMarker } from '@/app/chat/tour-marker'
import { useHudComposerDrag } from '@/app/hud/composer-drag'
import { composerFloatingStrip, composerInputBacking } from '@/components/chat/composer-dock'
+import { OnboardingSkip } from '@/components/onboarding/skip-setup'
import { Button } from '@/components/ui/button'
import { Slot as ContribSlot } from '@/contrib/react/slot'
import { useI18n } from '@/i18n'
@@ -1290,6 +1291,7 @@ export function ChatBar({
<div className={cn(composerFloatingStrip, 'px-[5px] pb-1.5 empty:hidden')}>
<ActionBadges sessionId={statusSessionId} />
<SuggestionPills sessionId={statusSessionId} />
+ <OnboardingSkip sessionId={statusSessionId} />
</div>
{/* Session-scoped status stack (todos, subagents, background tasks,
queue). An in-flow dock child: the dock is bottom-anchored, so it
diff --git a/apps/desktop/src/app/contrib/wiring.tsx b/apps/desktop/src/app/contrib/wiring.tsx
index 2dedf98f8b0..e66ca109e54 100644
--- a/apps/desktop/src/app/contrib/wiring.tsx
+++ b/apps/desktop/src/app/contrib/wiring.tsx
@@ -23,6 +23,7 @@ import { FreeTierSignInDialog } from '@/components/free-tier/sign-in-dialog'
import { GatewayConnectingOverlay } from '@/components/gateway-connecting-overlay'
import { NotificationStack } from '@/components/notifications'
import { DesktopOnboardingOverlay } from '@/components/onboarding'
+import { OnboardingEnd } from '@/components/onboarding/onboarding-end'
import { $newSessionTabAction, registerPaneCloser } from '@/components/pane-shell/tree/store'
import {
$workspaceMode,
@@ -1274,6 +1275,7 @@ export function ContribWiring({ children }: { children: ReactNode }) {
requestGateway={requestGateway}
/>
)}
+ {!isAuxiliaryWindow() && <OnboardingEnd />}
{!isAuxiliaryWindow() && (
<SharedMetricsConsentDialog
enabled={gatewayState === 'open'}
diff --git a/apps/desktop/src/app/settings/config-settings.tsx b/apps/desktop/src/app/settings/config-settings.tsx
index a35a087650d..10b6b3318e2 100644
--- a/apps/desktop/src/app/settings/config-settings.tsx
+++ b/apps/desktop/src/app/settings/config-settings.tsx
@@ -50,6 +50,7 @@ import {
import { MemoryConnect } from './memory/connect'
import { ProviderConfigPanel } from './memory/provider-config-panel'
import { ModelSettings, ModelSettingsSkeleton } from './model-settings'
+import { OnboardingSettings } from './onboarding-settings'
import { PoolLimitsSetting } from './pool-limits-setting'
import { EmptyState, ListRow, SettingsContent, SettingsSkeleton, ToggleRow } from './primitives'
import { SettingsProfileScope } from './profile-scope'
@@ -485,6 +486,7 @@ function ConfigSettingsInner({
/>
<PoolLimitsSetting />
<QuickEntrySettings />
+ <OnboardingSettings />
</>
)}
{/* Device-local attach/preview byte cap (main-process IPC guard). Chat is
diff --git a/apps/desktop/src/app/settings/onboarding-settings.tsx b/apps/desktop/src/app/settings/onboarding-settings.tsx
new file mode 100644
index 00000000000..f8dc7a18978
--- /dev/null
+++ b/apps/desktop/src/app/settings/onboarding-settings.tsx
@@ -0,0 +1,49 @@
+import { useState } from 'react'
+
+import { useGatewayRequest } from '@/app/gateway/hooks/use-gateway-request'
+import { sessionRoute } from '@/app/routes'
+import { Button } from '@/components/ui/button'
+import { useI18n } from '@/i18n'
+import { isOnboardingEnabled } from '@/lib/onboarding-enabled'
+import { notifyError } from '@/store/notifications'
+import { startOnboarding } from '@/store/onboarding-run'
+import { requestRoute } from '@/store/recovery-requests'
+
+import { ListRow } from './primitives'
+
+/** Advanced → Run onboarding again. Only builds with the guided first run show it. */
+export function OnboardingSettings() {
+ return isOnboardingEnabled() ? <RerunOnboardingRow /> : null
+}
+
+function RerunOnboardingRow() {
+ const copy = useI18n().t.firstRun.rerun
+ const { requestGateway } = useGatewayRequest()
+ const [starting, setStarting] = useState(false)
+
+ const rerun = async () => {
+ setStarting(true)
+
+ const started = await startOnboarding(requestGateway, async storedId => requestRoute(sessionRoute(storedId)), {
+ rerun: true
+ })
+
+ setStarting(false)
+
+ if (!started) {
+ notifyError(null, copy.failed)
+ }
+ }
+
+ return (
+ <ListRow
+ action={
+ <Button disabled={starting} onClick={() => void rerun()} size="sm" variant="outline">
+ {copy.action}
+ </Button>
+ }
+ description={copy.description}
+ title={copy.title}
+ />
+ )
+}
diff --git a/apps/desktop/src/components/onboarding/onboarding-end.test.tsx b/apps/desktop/src/components/onboarding/onboarding-end.test.tsx
new file mode 100644
index 00000000000..6b78b3c1a6c
--- /dev/null
+++ b/apps/desktop/src/components/onboarding/onboarding-end.test.tsx
@@ -0,0 +1,77 @@
+import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+
+import { $localSetupEligibility } from '@/store/local-setup-offer'
+import { markOnboardingDecided } from '@/store/onboarding-presence'
+import { $onboardingSettleFrom } from '@/store/onboarding-run'
+import { $connection } from '@/store/session'
+import type { LocalCatalogModel } from '@/types/hermes'
+
+import { OnboardingEnd } from './onboarding-end'
+
+const TITLE = 'This computer can run a model locally'
+// Past the longest settle window plus one tick.
+const SETTLED_MS = 10 * 60_000 + 30_000
+
+const MODEL: LocalCatalogModel = {
+ id: 'Qwen3.6-27B-UD-Q4_K_XL',
+ display_name: 'Qwen3.6 27B',
+ description: 'Best all-round agent model',
+ size_bytes: 17.6 * 2 ** 30,
+ size_label: '17.6 GB',
+ native_context: 262144,
+ native_context_label: '256K',
+ recommended: true,
+ downloaded: false,
+ mtp: false,
+ fits: true,
+ fit_summary: 'runs at its full 256K context'
+}
+
+beforeEach(() => {
+ vi.useFakeTimers()
+ // The quiet check: a focused, visible window with the boot onboarding check answered.
+ vi.spyOn(window.document, 'hasFocus').mockReturnValue(true)
+ vi.spyOn(window.document, 'visibilityState', 'get').mockReturnValue('visible')
+ markOnboardingDecided()
+ $connection.set({
+ baseUrl: 'http://127.0.0.1:1',
+ isFullscreen: false,
+ logs: [],
+ mode: 'local',
+ nativeOverlayWidth: 0,
+ token: '',
+ windowButtonPosition: null,
+ wsUrl: 'ws://127.0.0.1:1'
+ })
+ // Set after the connection, whose change drops the cached answer.
+ $localSetupEligibility.set({ checkedAt: Date.now(), fit: { model: MODEL }, reason: 'test' })
+})
+
+afterEach(() => {
+ cleanup()
+ vi.useRealTimers()
+ vi.restoreAllMocks()
+ window.localStorage.clear()
+ $onboardingSettleFrom.set(null)
+ $connection.set(null)
+})
+
+describe('OnboardingEnd', () => {
+ it('offers the local model once the settle window passes on a quiet app, once per install', async () => {
+ render(<OnboardingEnd />)
+
+ act(() => $onboardingSettleFrom.set(Date.now()))
+ await act(() => vi.advanceTimersByTimeAsync(4 * 60_000))
+ expect(screen.queryByText(TITLE)).toBeNull()
+
+ await act(() => vi.advanceTimersByTimeAsync(SETTLED_MS))
+ expect(screen.getByText(TITLE)).toBeTruthy()
+ fireEvent.click(screen.getByRole('button', { name: 'Not now' }))
+ expect(screen.queryByText(TITLE)).toBeNull()
+
+ act(() => $onboardingSettleFrom.set(Date.now()))
+ await act(() => vi.advanceTimersByTimeAsync(SETTLED_MS))
+ expect(screen.queryByText(TITLE)).toBeNull()
+ })
+})
diff --git a/apps/desktop/src/components/onboarding/onboarding-end.tsx b/apps/desktop/src/components/onboarding/onboarding-end.tsx
new file mode 100644
index 00000000000..70b1e32a408
--- /dev/null
+++ b/apps/desktop/src/components/onboarding/onboarding-end.tsx
@@ -0,0 +1,106 @@
+import { useStore } from '@nanostores/react'
+import { useEffect, useState } from 'react'
+
+import { SETTINGS_ROUTE } from '@/app/routes'
+import { appIsQuiet, SETTLE_MIN_MS, SETTLE_SPREAD_MS, TICK_MS } from '@/components/tips/use-tip-rotation'
+import { Button } from '@/components/ui/button'
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ preventCloseButtonAutoFocus
+} from '@/components/ui/dialog'
+import { useI18n } from '@/i18n'
+import { readKey, writeKey } from '@/lib/storage'
+import { readLocalSetupEligibility } from '@/store/local-setup-offer'
+import { $onboardingSettleFrom } from '@/store/onboarding-run'
+import { requestRoute } from '@/store/recovery-requests'
+import type { LocalCatalogModel } from '@/types/hermes'
+
+/** Install-level: the local-model offer opens at most once per install, and a dismiss is final. */
+export const LOCAL_MODEL_OFFERED_KEY = 'hermes.desktop.firstRun.localModelOffered.v1'
+
+/**
+ * The local-model offer after first-run onboarding: armed when a run ends or the user first leaves
+ * the onboarding chat, then shown at the first quiet moment once a settle window has passed.
+ */
+export function OnboardingEnd() {
+ const { t } = useI18n()
+ const settleFrom = useStore($onboardingSettleFrom)
+ const [offer, setOffer] = useState<LocalCatalogModel | null>(null)
+
+ useEffect(() => {
+ if (settleFrom === null || readKey(LOCAL_MODEL_OFFERED_KEY)) {
+ return
+ }
+
+ const settledAt = settleFrom + SETTLE_MIN_MS + Math.random() * SETTLE_SPREAD_MS
+ let lastTypedAt = 0
+ let checking = false
+ let cancelled = false
+
+ const noteTyping = () => {
+ lastTypedAt = Date.now()
+ }
+
+ const tick = async () => {
+ if (checking || Date.now() < settledAt || readKey(LOCAL_MODEL_OFFERED_KEY) || !appIsQuiet(lastTypedAt)) {
+ return
+ }
+
+ checking = true
+ const { fit } = await readLocalSetupEligibility()
+ checking = false
+
+ // The read is async: the moment may have stopped being quiet while it ran.
+ if (cancelled || !fit || readKey(LOCAL_MODEL_OFFERED_KEY) || !appIsQuiet(lastTypedAt)) {
+ return
+ }
+
+ writeKey(LOCAL_MODEL_OFFERED_KEY, '1')
+ window.clearInterval(timer)
+ setOffer(fit.model)
+ }
+
+ const timer = window.setInterval(() => void tick(), TICK_MS)
+ window.addEventListener('keydown', noteTyping, true)
+
+ return () => {
+ cancelled = true
+ window.clearInterval(timer)
+ window.removeEventListener('keydown', noteTyping, true)
+ }
+ }, [settleFrom])
+
+ const copy = t.firstRun.localModel
+
+ return (
+ <Dialog onOpenChange={open => !open && setOffer(null)} open={offer !== null}>
+ {offer && (
+ <DialogContent onOpenAutoFocus={preventCloseButtonAutoFocus}>
+ <DialogHeader>
+ <DialogTitle>{copy.title}</DialogTitle>
+ <DialogDescription>{copy.text(offer.display_name, offer.size_label)}</DialogDescription>
+ </DialogHeader>
+ <DialogFooter>
+ <Button onClick={() => setOffer(null)} size="sm" type="button" variant="text">
+ {copy.notNow}
+ </Button>
+ <Button
+ onClick={() => {
+ setOffer(null)
+ requestRoute(`${SETTINGS_ROUTE}?tab=providers&pview=local`)
+ }}
+ type="button"
+ >
+ {copy.setUp}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ )}
+ </Dialog>
+ )
+}
diff --git a/apps/desktop/src/components/onboarding/skip-setup.tsx b/apps/desktop/src/components/onboarding/skip-setup.tsx
new file mode 100644
index 00000000000..ea2fce1ac5d
--- /dev/null
+++ b/apps/desktop/src/components/onboarding/skip-setup.tsx
@@ -0,0 +1,35 @@
+import { useStore } from '@nanostores/react'
+
+import { useGatewayRequest } from '@/app/gateway/hooks/use-gateway-request'
+import { Tip } from '@/components/ui/tooltip'
+import { useI18n } from '@/i18n'
+import { $onboardingSession, skipOnboarding } from '@/store/onboarding-run'
+
+/** Skip setup, shown in the composer of the onboarding chat only. */
+export function OnboardingSkip({ sessionId }: { sessionId: null | string }) {
+ const session = useStore($onboardingSession)
+
+ if (!session || !sessionId || session.runtimeId !== sessionId) {
+ return null
+ }
+
+ return <SkipButton runtimeId={session.runtimeId} />
+}
+
+// Split out so the gateway hook mounts only in the onboarding chat, not in every composer.
+function SkipButton({ runtimeId }: { runtimeId: string }) {
+ const { t } = useI18n()
+ const { requestGateway } = useGatewayRequest()
+
+ return (
+ <Tip label={t.firstRun.skipTip}>
+ <button
+ className="ml-auto text-[11px] text-(--ui-text-quaternary) transition-colors hover:text-(--ui-text-secondary)"
+ onClick={() => void skipOnboarding(requestGateway, runtimeId)}
+ type="button"
+ >
+ {t.firstRun.skip}
+ </button>
+ </Tip>
+ )
+}
diff --git a/apps/desktop/src/components/tips/use-tip-rotation.ts b/apps/desktop/src/components/tips/use-tip-rotation.ts
index 4fac3ceef43..b71bd7ddf03 100644
--- a/apps/desktop/src/components/tips/use-tip-rotation.ts
+++ b/apps/desktop/src/components/tips/use-tip-rotation.ts
@@ -36,13 +36,13 @@ import { checkTutorialLifetime } from '@/store/tutorial-lifetime'
import { offerLocalRuntimeUpdateTip } from './local-runtime-update-offer'
-const TICK_MS = 30_000
+export const TICK_MS = 30_000
const UPDATE_TICK_MS = 1_000
/** Nothing in the first stretch of a launch, however long the cooldown says
* it's been: you opened the app to do a thing, and the tip can wait until
* you've done it. Jittered so it isn't the same beat every time. */
-const SETTLE_MIN_MS = 5 * 60_000
-const SETTLE_SPREAD_MS = 5 * 60_000
+export const SETTLE_MIN_MS = 5 * 60_000
+export const SETTLE_SPREAD_MS = 5 * 60_000
/** Typing is the clearest "I'm busy" signal the renderer gets for free. */
const TYPING_GRACE_MS = 5_000
@@ -51,7 +51,8 @@ const TYPING_GRACE_MS = 5_000
const BLOCKING_SURFACES =
'[role="dialog"],[role="alertdialog"],[role="menu"],[role="listbox"],[data-overlay-surface],.driver-popover'
-function appIsQuiet(lastTypedAt: number): boolean {
+/** Nothing streaming, no surface open, the window focused and the user not typing: a tip or offer may show. */
+export function appIsQuiet(lastTypedAt: number): boolean {
if (document.visibilityState !== 'visible' || !document.hasFocus()) {
return false
}
diff --git a/apps/desktop/src/store/onboarding-run.ts b/apps/desktop/src/store/onboarding-run.ts
index 0427f583f35..b21d43919fc 100644
--- a/apps/desktop/src/store/onboarding-run.ts
+++ b/apps/desktop/src/store/onboarding-run.ts
@@ -43,12 +43,23 @@ export const $onboardingSettleFrom = atom<null | number>(null)
// The backend runs onboarding in its root profile whichever profile the app was on.
const ONBOARDING_PROFILE = 'default'
-/** A run is starting (no chat yet), or its chat is the one on screen. */
+/** The run's chat has been on screen at least once; until then a route still opening is not a leave. */
+const $onboardingChatSeen = atom(false)
+
+/** A run is starting (its chat not on screen yet), or its chat is the one on screen. */
const $onboardingOnScreen = computed(
- [$onboardingPhase, $onboardingSession, $selectedStoredSessionId],
- (phase, session, selected) => phase === 'shown' && (!session || session.storedId === selected)
+ [$onboardingPhase, $onboardingSession, $selectedStoredSessionId, $onboardingChatSeen],
+ (phase, session, selected, seen) => phase === 'shown' && (!session || !seen || session.storedId === selected)
)
+computed([$onboardingSession, $selectedStoredSessionId], (session, selected) =>
+ Boolean(session && session.storedId === selected)
+).subscribe(onChat => {
+ if (onChat) {
+ $onboardingChatSeen.set(true)
+ }
+})
+
$onboardingOnScreen.subscribe(onScreen => {
setOnboardingSurfaceActive('onboarding', onScreen)
@@ -93,6 +104,7 @@ export async function startOnboarding(
): Promise<boolean> {
$onboardingPhase.set('shown')
$onboardingEnded.set(null)
+ $onboardingChatSeen.set(false)
try {
await ensureProfile(ONBOARDING_PROFILE)