The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): keep startup covered until the guide loads
alt-glitch6146bff09da0
diff --git a/apps/desktop/DESIGN.md b/apps/desktop/DESIGN.mdindex 05bc7f5d4df..3b33896d975 100644--- a/apps/desktop/DESIGN.md+++ b/apps/desktop/DESIGN.md@@ -283,12 +283,13 @@ so glass and message-bubble transparency do not reveal scrolling text.- Install, onboarding, connecting, boot failure, and reauthentication aredistinct states with shared visual primitives. Preserve their recoverysemantics when unifying appearance.-- Guide arrival shows the locally known greeting in the transcript position,- revealed at 18 graphemes per second with the existing markdown cursor. No- status copy or spinner. Composer, Skip setup, and statusbar stay unmounted- until the seeded session has been adopted; then controls fade in over 100ms.- Reduced motion shows the complete greeting immediately. Never invent a new- greeting on a resumed guide or delay backend readiness for the animation.+- Guide startup has a dedicated landing screen with the shared long-operation+ Loader and a localized startup label. It remains active until the guide's+ saved conversation is loaded. No greeting, composer, Skip setup, or statusbar+ appears early. Reduced motion uses a static BrandMark and the same label.+ On readiness, reveal the real conversation and fade controls in over 100ms.+ Never fabricate progress, delay readiness for motion, or replace a resumed+ conversation with a new greeting.- Respect `AppShell` overlay ownership. Persistent terminal/content layers,route overlays, dialogs, and boot surfaces must not compete through ad-hocz-index literals. Pick a rung of the ladder in `styles.css` instead βdiff --git a/apps/desktop/src/app/chat/index.tsx b/apps/desktop/src/app/chat/index.tsxindex 94a81320e1f..5c6317cee34 100644--- a/apps/desktop/src/app/chat/index.tsx+++ b/apps/desktop/src/app/chat/index.tsx@@ -13,7 +13,6 @@ import { Thread } from '@/components/assistant-ui/thread'import { TranscriptWindowProvider } from '@/components/assistant-ui/thread/transcript-window'import { Backdrop } from '@/components/Backdrop'import { COMPOSER_HEART_CONFIG, HeartField } from '@/components/chat/vibe-hearts'-import { GuideGreetingPreview } from '@/components/onboarding-chat/greeting-preview'import { usePaneVisible } from '@/components/pane-shell/pane-visibility'import { $sessionTileDragging, $sessionTileEdgeHover } from '@/components/pane-shell/tree/store'import { PromptOverlays } from '@/components/prompt-overlays'@@ -721,9 +720,7 @@ const ChatViewContent = memo(function ChatViewContent({data-slot="composer-bounds"{...dropHandlers}>- {guideOpening ? (- <GuideGreetingPreview />- ) : (+ {!guideOpening && (<ThreadclampToComposer={showChatBar}cwd={currentCwd}diff --git a/apps/desktop/src/app/contrib/onboarding-kickoff.test.ts b/apps/desktop/src/app/contrib/onboarding-kickoff.test.tsnew file mode 100644index 00000000000..a4a0c818d87--- /dev/null+++ b/apps/desktop/src/app/contrib/onboarding-kickoff.test.ts@@ -0,0 +1,99 @@+import { afterEach, expect, it, vi } from 'vitest'++import type { ClientSessionState } from '@/app/types'+import { $setupSession, SETUP_PROFILE } from '@/components/onboarding-chat/setup-profile'+import { assistantTextPart } from '@/lib/chat-messages'+import { $activeGatewayProfile } from '@/store/profile'+import { $activeSessionId, $messages, $selectedStoredSessionId } from '@/store/session'+import { $sessionStates } from '@/store/session-states'++import { adoptGuideSession } from './onboarding-kickoff'++const messages = [{ id: 'greeting', role: 'assistant' as const, parts: [assistantTextPart('Welcome back')] }]++function publishGuide(storedSessionId: string, visible = true) {+ const state: ClientSessionState = {+ storedSessionId,+ messages,+ branch: '',+ cwd: '',+ model: '',+ provider: '',+ reasoningEffort: '',+ serviceTier: '',+ fast: false,+ yolo: false,+ personality: '',+ busy: false,+ awaitingResponse: false,+ streamId: null,+ sawAssistantPayload: false,+ adoptedRunningTurn: false,+ pendingBranchGroup: null,+ interrupted: false,+ interimBoundaryPending: false,+ needsInput: false,+ turnStartedAt: null,+ turnLive: false,+ usage: null+ }++ $sessionStates.set({ 'runtime-guide': state })+ $activeSessionId.set('runtime-guide')+ $selectedStoredSessionId.set(storedSessionId)+ $activeGatewayProfile.set(SETUP_PROFILE)+ $messages.set(visible ? messages : [])+}++afterEach(() => {+ $sessionStates.set({})+ $activeSessionId.set(null)+ $selectedStoredSessionId.set(null)+ $activeGatewayProfile.set('default')+ $messages.set([])+ $setupSession.set(null)+})++it('adopts the resumed runtime only after the correct saved transcript is visible', async () => {+ const request = vi.fn(async () => {+ throw new Error('Unexpected configuration request')+ })++ await adoptGuideSession(+ { id: 'guide', resolved_id: 'guide-tip' },+ false,+ async () => {+ publishGuide('guide-tip')+ },+ request+ )+ expect($setupSession.get()).toMatchObject({ storedId: 'guide', runtimeId: 'runtime-guide', profile: SETUP_PROFILE })+ expect(request).not.toHaveBeenCalled()+ expect($messages.get()).toEqual(messages)+})++it.each(['empty', 'wrong-session', 'wrong-profile', 'no-runtime'])(+ 'rejects a settled resume with %s instead of releasing startup',+ async failure => {+ const request = vi.fn(async () => {+ throw new Error('Unexpected configuration request')+ })++ await expect(+ adoptGuideSession(+ { id: 'guide' },+ false,+ async () => {+ publishGuide(failure === 'wrong-session' ? 'other' : 'guide', failure !== 'empty')++ if (failure === 'wrong-profile') {$activeGatewayProfile.set('default')}++ if (failure === 'no-runtime') {$activeSessionId.set(null)}+ },+ request+ )+ ).rejects.toThrow('could not be loaded')+ expect($setupSession.get()).toBeNull()+ expect(request).not.toHaveBeenCalled()+ }+)diff --git a/apps/desktop/src/app/contrib/onboarding-kickoff.ts b/apps/desktop/src/app/contrib/onboarding-kickoff.tsindex eb013b9a8d6..33b9ffcfe04 100644--- a/apps/desktop/src/app/contrib/onboarding-kickoff.ts+++ b/apps/desktop/src/app/contrib/onboarding-kickoff.ts@@ -15,6 +15,7 @@ import {SETUP_CHAT_TITLE,SETUP_PROFILE} from '@/components/onboarding-chat/setup-profile'+import { chatMessageText } from '@/lib/chat-messages'import { isOnboardingEnabled } from '@/lib/onboarding-enabled'import { activeGatewayConnectionId, requestGatewayForProfile } from '@/store/gateway'import { loadMachineProfile } from '@/store/machine'@@ -28,7 +29,8 @@ import {ensureGatewayAgent,ensureGatewayProfile} from '@/store/profile'-import { $activeSessionId, $selectedStoredSessionId } from '@/store/session'+import { $activeSessionId, $messages, $selectedStoredSessionId } from '@/store/session'+import { $sessionStates } from '@/store/session-states'import type { AmbientGatewayRequest } from './session-rpc-dispatcher'@@ -52,7 +54,7 @@ interface GuideSession {resolved_id?: string}-async function adoptGuideSession(+export async function adoptGuideSession(canonical: GuideSession,freeTier: SetupStatus['free_tier'],resumeSession: OnboardingKickoffOptions['resumeSession'],@@ -60,17 +62,32 @@ async function adoptGuideSession(): Promise<void> {await resumeSession(canonical.resolved_id ?? canonical.id, true)const adoptedRuntimeId = $activeSessionId.get()- $chatOnboardingThreadIds.set(adoptedRuntimeId ? [canonical.id, adoptedRuntimeId] : [canonical.id])+ const state = adoptedRuntimeId ? $sessionStates.get()[adoptedRuntimeId] : undefined++ // resumeSession can settle without adopting (failed or superseded resume).+ // Only release the splash for the guide's actual binding and visible transcript.+ if (+ !adoptedRuntimeId ||+ !state?.storedSessionId ||+ ![canonical.id, canonical.resolved_id].includes(state.storedSessionId) ||+ $selectedStoredSessionId.get() !== state.storedSessionId ||+ $activeGatewayProfile.get() !== SETUP_PROFILE ||+ !$messages.get().some(message => message.role === 'assistant' && !message.hidden && chatMessageText(message).trim())+ ) {+ throw new Error('The welcome conversation could not be loaded. Please try again.')+ }++ $chatOnboardingThreadIds.set([canonical.id, adoptedRuntimeId])$setupSession.set({connectionId: guideSourceConnectionId(canonical.id),profile: SETUP_PROFILE,- runtimeId: adoptedRuntimeId ?? canonical.id,+ runtimeId: adoptedRuntimeId,storedId: canonical.id})if (freeTier) {await guideRequest('config.set', {- session_id: adoptedRuntimeId ?? canonical.id,+ session_id: adoptedRuntimeId,key: 'reasoning',value: 'minimal'})@@ -155,20 +172,11 @@ export function useOnboardingKickoff({}const storedId = $selectedStoredSessionId.get()- $chatOnboardingThreadIds.set(storedId ? [storedId, runtimeId] : [runtimeId])- $setupSession.set({- connectionId: guideSourceConnectionId(storedId),- profile: SETUP_PROFILE,- runtimeId,- storedId- })// Set the title explicitly so the backend does not name the session after the hidden runbook message.await guideRequest('session.title', { session_id: runtimeId, title: SETUP_CHAT_TITLE }).catch(() => undefined)- // Creation persists the seed but resets the renderer's transcript. Adopt- // it before removing the local greeting, so the handoff has no blank frame.- await resumeSession(storedId ?? runtimeId, true)+ await adoptGuideSession({ id: storedId ?? runtimeId }, record.free_tier, resumeSession, guideRequest)return true} catch (error) {diff --git a/apps/desktop/src/components/assistant-ui/markdown-text.tsx b/apps/desktop/src/components/assistant-ui/markdown-text.tsxindex 8e70a0bad5d..d0e04ca3f48 100644--- a/apps/desktop/src/components/assistant-ui/markdown-text.tsx+++ b/apps/desktop/src/components/assistant-ui/markdown-text.tsx@@ -448,7 +448,6 @@ function MarkdownImageContent({ className, src, alt, ...props }: ComponentProps<}interface MarkdownTextSurfaceProps {- caret?: ComponentProps<typeof StreamdownTextPrimitive>['caret']containerClassName?: stringcontainerProps?: ComponentProps<'div'>defer?: boolean@@ -576,7 +575,6 @@ function MarkdownParagraph({}function MarkdownTextSurface({- caret,containerClassName,containerProps,defer,@@ -728,7 +726,6 @@ function MarkdownTextSurface({label="markdown-render"><StreamdownTextPrimitive- caret={caret}components={components}containerClassName={cn(MARKDOWN_CONTAINER_CLASS_NAME, containerClassName)}containerProps={containerProps}diff --git a/apps/desktop/src/components/intro-reveal/index.tsx b/apps/desktop/src/components/intro-reveal/index.tsxindex 432d22571c9..98df6ed1ac0 100644--- a/apps/desktop/src/components/intro-reveal/index.tsx+++ b/apps/desktop/src/components/intro-reveal/index.tsx@@ -1,5 +1,5 @@import { useStore } from '@nanostores/react'-import { useEffect } from 'react'+import { useEffect, useLayoutEffect } from 'react'import { takeGuideShape } from '@/components/onboarding-chat/assembly'import {@@ -13,7 +13,12 @@ import {startIntroReveal} from '@/store/intro-reveal'import { $desktopOnboarding } from '@/store/onboarding'-import { beginOnboardingFlow, beginOnboardingFlowWithoutIntro, queueGuideAfterIntro } from '@/store/onboarding-gate'+import {+ $onboardingGate,+ beginOnboardingFlow,+ beginOnboardingFlowWithoutIntro,+ queueGuideAfterIntro+} from '@/store/onboarding-gate'import { INTRO_DEADMAN_MS, INTRO_EXIT_MS } from './timeline'@@ -48,24 +53,19 @@ export function IntroRevealGate({ enabled }: IntroRevealGateProps) {})}, [enabled])- useEffect(() => {- if (!enabled) {- return- }+ // The skipped-film path needs no backend. Cover the composer before first paint.+ useLayoutEffect(() => {+ if (isIntroRevealSkipped() && intro.phase === 'hidden') {+ beginOnboardingFlowWithoutIntro(onboarding.firstRunSkipped)- // skipIntro turns the film off; the guided chat behind it must still run.- // Take the guide's shape on this tick, exactly like the film's completion- // edge, so no full-size shell paints while the guide session comes up.- if (isIntroRevealSkipped()) {- if (intro.phase === 'hidden') {- beginOnboardingFlowWithoutIntro(onboarding.firstRunSkipped)+ if ($onboardingGate.get().guideQueued) {takeGuideShape()}-- return}+ }, [intro.phase, onboarding.firstRunSkipped])- if (intro.phase === 'hidden' && shouldPlayFirstRunIntro(onboarding.firstRunSkipped)) {+ useEffect(() => {+ if (enabled && intro.phase === 'hidden' && shouldPlayFirstRunIntro(onboarding.firstRunSkipped)) {beginOnboardingFlow()startIntroReveal()}diff --git a/apps/desktop/src/components/onboarding-chat/assembly.ts b/apps/desktop/src/components/onboarding-chat/assembly.tsindex 093b4ed94f2..627a48ee3a4 100644--- a/apps/desktop/src/components/onboarding-chat/assembly.ts+++ b/apps/desktop/src/components/onboarding-chat/assembly.ts@@ -39,8 +39,7 @@ $chatOnboardingSolo.subscribe(solo => setOnboardingSurfaceActive('solo-chat', so* identify the conversation that gets onboarding transcript treatment. */export const $chatOnboardingThreadIds = atom<readonly string[]>([])-/** Holds the localized opener so it is ready before inference: cold first turns took 10 s. The typed reveal and the- * seed rows read this same string, so the model receives the text the user saw. */+/** The greeting is seeded locally, without an inference request. */export const $onboardingGreeting = atom('')/** First-write-wins keeps the opener stable through profile and backend boot. */@@ -54,9 +53,10 @@ export function pickOnboardingGreeting(): string {const copy = TRANSLATIONS[getRuntimeI18nLocale()].guidedGreetingconst suggested = machineUserName()- $onboardingGreeting.set(suggested ? `${copy.line}\n\n${copy.nameSuggestion(suggested)}` : copy.line)+ const greeting = suggested ? `${copy.line}\n\n${copy.nameSuggestion(suggested)}` : copy.line+ $onboardingGreeting.set(greeting)- return $onboardingGreeting.get()+ return greeting}/** Applying a layout remounts the card, so its selection must outlive the component. */@@ -88,13 +88,7 @@ export function startChatOnboardingSolo(): void {previousLayout = { id: $activePresetId.get(), tree: $layoutTree.get() }$chatOnboardingSolo.set(true)$chatLayoutPicked.set(false)- // The local machine probe finishes before the backend boots, letting the- // greeting type while kickoff is still waiting for a session.- void loadMachineProfile().then(() => {- if ($chatOnboardingSolo.get()) {- pickOnboardingGreeting()- }- })+ void loadMachineProfile()// Adoption puts other panes in this same group. Hiding its strip keeps them// invisible, including reactive arrivals, until a layout places them.applyLayoutPreset('chat-solo', group(['workspace'], { tabStrip: 'never' }))diff --git a/apps/desktop/src/components/onboarding-chat/gate.test.tsx b/apps/desktop/src/components/onboarding-chat/gate.test.tsxnew file mode 100644index 00000000000..734197f426c--- /dev/null+++ b/apps/desktop/src/components/onboarding-chat/gate.test.tsx@@ -0,0 +1,65 @@+import { act, cleanup, render, screen, waitFor } from '@testing-library/react'+import { afterEach, expect, it, vi } from 'vitest'++import { I18nProvider } from '@/i18n'++afterEach(() => {+ cleanup()+ vi.unstubAllGlobals()+})++it('starts the skipped-film splash before the backend connects and removes it only after adoption', async () => {+ vi.resetModules()+ vi.stubGlobal('hermesDesktop', { guestOnboardingEnabled: true, skipIntro: true })+ const { IntroRevealGate } = await import('@/components/intro-reveal')+ const { OnboardingChatGate } = await import('./gate')+ const { $onboardingGate } = await import('@/store/onboarding-gate')+ const { $desktopOnboarding } = await import('@/store/onboarding')+ $onboardingGate.set({ phase: 'idle', guideQueued: false, guideKickoff: 'idle' })+ $desktopOnboarding.set({ ...$desktopOnboarding.get(), firstRunSkipped: false })++ let complete = (_ready: boolean) => {}+ const pending = new Promise<boolean>(resolve => { complete = resolve })+ const kickoff = vi.fn(() => pending)++ const request = async () => { throw new Error('No provider notice available') }++ const view = (enabled: boolean) => (+ <I18nProvider>+ <IntroRevealGate enabled={enabled} />+ <OnboardingChatGate enabled={enabled} onKickoff={kickoff} requestGateway={request} />+ </I18nProvider>+ )++ const { rerender } = render(view(false))+ expect(screen.getByRole('status').textContent).toMatch(/Starting Hermes/)+ expect(kickoff).not.toHaveBeenCalled()+ rerender(view(true))+ await waitFor(() => expect(kickoff).toHaveBeenCalledOnce())+ expect(screen.getByRole('status')).toBeTruthy()+ await act(async () => { complete(true); await pending })+ expect(screen.queryByRole('status')).toBeNull()+ expect($onboardingGate.get().guideKickoff).toBe('started')+})++it.each(['refused', 'rejected'])('restores the ordinary app after %s startup', async outcome => {+ vi.resetModules()+ vi.stubGlobal('hermesDesktop', { guestOnboardingEnabled: true, skipIntro: true })+ const { OnboardingChatGate } = await import('./gate')+ const { $onboardingGate } = await import('@/store/onboarding-gate')+ const { $chatOnboardingSolo } = await import('./assembly')+ $onboardingGate.set({ phase: 'cinematic', guideQueued: true, guideKickoff: 'idle' })++ const kickoff = vi.fn(async () => {+ if (outcome === 'rejected') {throw new Error('Backend unavailable')}++ return false+ })++ const request = async () => { throw new Error('No provider notice available') }+ render(<I18nProvider><OnboardingChatGate enabled onKickoff={kickoff} requestGateway={request} /></I18nProvider>)+ await waitFor(() => expect($onboardingGate.get().phase).toBe('skipped'))+ expect(screen.queryByRole('status')).toBeNull()+ expect($chatOnboardingSolo.get()).toBe(false)+ expect(kickoff).toHaveBeenCalledOnce()+})diff --git a/apps/desktop/src/components/onboarding-chat/gate.tsx b/apps/desktop/src/components/onboarding-chat/gate.tsxindex ccbcba8214c..766fe5f5f40 100644--- a/apps/desktop/src/components/onboarding-chat/gate.tsx+++ b/apps/desktop/src/components/onboarding-chat/gate.tsx@@ -6,7 +6,9 @@ import { isOnboardingEnabled } from '@/lib/onboarding-enabled'import { ackFreeTierNotice, type FreeTierRequester } from '@/store/free-tier'import { $introReveal } from '@/store/intro-reveal'import { clearFreeTierIntro } from '@/store/onboarding'-import { $onboardingGate, runGuideKickoff, skipGuide } from '@/store/onboarding-gate'+import { $guideOpening, $onboardingGate, runGuideKickoff, skipGuide } from '@/store/onboarding-gate'++import { GuideLoading } from './guide-loading'interface OnboardingChatGateProps {enabled: boolean@@ -17,6 +19,7 @@ interface OnboardingChatGateProps {export function OnboardingChatGate({ enabled, onKickoff, requestGateway }: OnboardingChatGateProps) {const gate = useStore($onboardingGate)const intro = useStore($introReveal)+ const opening = useStore($guideOpening)// A guide is owed the moment the renderer knows it (cinematic with the film// seen, or a relaunch mid-guide). Take the solo shape now, before the@@ -82,5 +85,5 @@ export function OnboardingChatGate({ enabled, onKickoff, requestGateway }: Onboa}}, [enabled, gate.guideQueued, intro.phase, onKickoff])- return null+ return opening ? <GuideLoading /> : null}diff --git a/apps/desktop/src/components/onboarding-chat/greeting-preview.test.tsx b/apps/desktop/src/components/onboarding-chat/greeting-preview.test.tsxdeleted file mode 100644index e450ae8838f..00000000000--- a/apps/desktop/src/components/onboarding-chat/greeting-preview.test.tsx+++ /dev/null@@ -1,41 +0,0 @@-import { act, cleanup, render } from '@testing-library/react'-import { afterEach, expect, it, vi } from 'vitest'--import { I18nProvider } from '@/i18n'--import { GreetingPreviewText, greetingRevealFrames } from './greeting-preview'--afterEach(() => {- cleanup()- vi.unstubAllGlobals()-})--it('reveals the exact greeting in graphemes and cancels its pending frame on unmount', () => {- const text = 'Hi π©π½βπ».\n\nδ½ ε₯½'- const frames = greetingRevealFrames(text)- const boundary = frames.find(frame => text.slice(0, frame.end).endsWith('π©π½βπ»'))- expect(boundary).toBeDefined()- expect(frames.at(-1)?.end).toBe(text.length)- expect(frames.every((frame, index) => index === 0 || frame.at > frames[index - 1].at)).toBe(true)-- let next: FrameRequestCallback | undefined- const cancel = vi.fn()- vi.stubGlobal('requestAnimationFrame', (callback: FrameRequestCallback) => {- next = callback-- return 1- })- vi.stubGlobal('cancelAnimationFrame', cancel)-- const { container, unmount } = render(- <I18nProvider>- <GreetingPreviewText text={text} />- </I18nProvider>- )-- expect(container.querySelector('.sr-only')?.textContent).toBe(text)- act(() => next?.(performance.now() + 200))- expect(container.querySelector('[aria-hidden]')?.textContent).not.toContain('δ½ ε₯½')- unmount()- expect(cancel).toHaveBeenCalled()-})diff --git a/apps/desktop/src/components/onboarding-chat/greeting-preview.tsx b/apps/desktop/src/components/onboarding-chat/greeting-preview.tsxdeleted file mode 100644index 66a76ebc533..00000000000--- a/apps/desktop/src/components/onboarding-chat/greeting-preview.tsx+++ /dev/null@@ -1,89 +0,0 @@-import './greeting-preview.css'--import { useStore } from '@nanostores/react'-import { useReducedMotion } from 'motion/react'-import { useEffect, useMemo, useState } from 'react'--import { MarkdownTextContent } from '@/components/assistant-ui/markdown-text'-import { $onboardingGreeting } from '@/components/onboarding-chat/assembly'-import { $onboardingGate } from '@/store/onboarding-gate'--/** Grapheme boundaries keep translated greetings and combined characters intact. */-export function greetingRevealFrames(text: string): { end: number; at: number }[] {- const frames = []- let at = 0-- for (const { index, segment } of new Intl.Segmenter(undefined, { granularity: 'grapheme' }).segment(text)) {- frames.push({ end: index + segment.length, at })- at += 1000 / 18-- if (/[.!?γοΌοΌ]$/u.test(segment)) {- at += 220- } else if (segment === '\n' && text[index - 1] === '\n') {- at += 650- }- }-- return frames-}--export function GreetingPreviewText({ text }: { text: string }) {- const reducedMotion = useReducedMotion()- const frames = useMemo(() => greetingRevealFrames(text), [text])- const [end, setEnd] = useState(0)-- useEffect(() => {- if (reducedMotion || !frames.length) {- return- }-- let frame = 0- let index = 0- const start = performance.now()-- const reveal = (now: number) => {- while (index < frames.length && frames[index].at <= now - start) {- index += 1- }-- setEnd(index ? frames[index - 1].end : 0)-- if (index < frames.length) {- frame = requestAnimationFrame(reveal)- }- }-- frame = requestAnimationFrame(reveal)-- return () => cancelAnimationFrame(frame)- }, [frames, reducedMotion])-- const visible = reducedMotion ? text : text.slice(0, end)-- return (- <div data-role="assistant" data-slot="guide-greeting-preview">- <span className="sr-only">{text}</span>- <div- aria-hidden- className="wrap-anywhere min-w-0 max-w-full overflow-hidden text-pretty text-[length:var(--conversation-text-font-size)] leading-(--dt-line-height) text-foreground"- data-slot="aui_assistant-message-content"- >- <MarkdownTextContent caret={reducedMotion ? undefined : 'block'} isRunning={visible !== text} text={visible} />- </div>- </div>- )-}--/** A local presentation of the exact greeting later persisted by session.create. */-export function GuideGreetingPreview() {- const greeting = useStore($onboardingGreeting)- const gate = useStore($onboardingGate)-- return (- <div className="h-full overflow-y-auto" data-slot="guide-opening">- <div className="mx-auto w-full max-w-(--composer-width) min-w-0 px-6 pt-[calc(var(--titlebar-height)-0.5rem)]">- {gate.phase === 'cinematic' && greeting && <GreetingPreviewText key={greeting} text={greeting} />}- </div>- </div>- )-}diff --git a/apps/desktop/src/components/onboarding-chat/greeting-preview.css b/apps/desktop/src/components/onboarding-chat/guide-loading.csssimilarity index 100%rename from apps/desktop/src/components/onboarding-chat/greeting-preview.cssrename to apps/desktop/src/components/onboarding-chat/guide-loading.cssdiff --git a/apps/desktop/src/components/onboarding-chat/guide-loading.test.tsx b/apps/desktop/src/components/onboarding-chat/guide-loading.test.tsxnew file mode 100644index 00000000000..dbf4655f147--- /dev/null+++ b/apps/desktop/src/components/onboarding-chat/guide-loading.test.tsx@@ -0,0 +1,55 @@+import { act, cleanup, render, screen } from '@testing-library/react'+import { afterEach, expect, it, vi } from 'vitest'++import { I18nProvider } from '@/i18n'++import { GuideLoading } from './guide-loading'++afterEach(() => {+ cleanup()+ vi.unstubAllGlobals()+})++it.each([false, true])('keeps startup visible without chat controls (reduced motion: %s)', reducedMotion => {+ vi.stubGlobal('matchMedia', () => ({+ matches: reducedMotion,+ addEventListener: () => {},+ removeEventListener: () => {}+ }))+ let next: FrameRequestCallback | undefined+ const cancel = vi.fn()+ vi.stubGlobal('requestAnimationFrame', (callback: FrameRequestCallback) => {+ next = callback++ return 1+ })+ vi.stubGlobal('cancelAnimationFrame', cancel)++ const { container, unmount } = render(+ <I18nProvider>+ <GuideLoading />+ </I18nProvider>+ )++ const status = screen.getByRole('status')+ expect(status.getAttribute('aria-busy')).toBe('true')+ expect(status.textContent).toMatch(/Starting Hermes Desktop/)+ expect(container.querySelector('input, textarea, [contenteditable], button')).toBeNull()++ if (reducedMotion) {+ expect(next).toBeUndefined()+ expect(status.querySelector('img')).not.toBeNull()+ } else {+ const path = status.querySelector('path')+ const before = path?.getAttribute('d')+ act(() => next?.(performance.now() + 60_000))+ expect(path?.getAttribute('d')).not.toBe(before)+ expect(screen.getByRole('status')).toBe(status)+ }++ unmount()++ if (!reducedMotion) {+ expect(cancel).toHaveBeenCalled()+ }+})diff --git a/apps/desktop/src/components/onboarding-chat/guide-loading.tsx b/apps/desktop/src/components/onboarding-chat/guide-loading.tsxnew file mode 100644index 00000000000..ab3b3e9143b--- /dev/null+++ b/apps/desktop/src/components/onboarding-chat/guide-loading.tsx@@ -0,0 +1,33 @@+import './guide-loading.css'++import { BrandMark } from '@/components/brand-mark'+import { Loader } from '@/components/ui/loader'+import { useMediaQuery } from '@/hooks/use-media-query'+import { useI18n } from '@/i18n'++/** Stays independent of greeting discovery and transcript hydration. */+export function GuideLoading() {+ const { t } = useI18n()+ const reducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)')+ const label = t.boot.steps.startingHermesDesktop++ return (+ <div+ aria-busy="true"+ aria-label={label}+ className="fixed inset-0 z-(--z-onboarding) grid place-items-center bg-(--ui-chat-surface-background) px-8"+ data-glass-opaque=""+ data-slot="guide-opening"+ role="status"+ >+ <div className="flex flex-col items-center gap-6 pb-12 text-center">+ {reducedMotion ? (+ <BrandMark aria-hidden="true" className="size-20" />+ ) : (+ <Loader aria-hidden="true" className="size-24" role="presentation" type="lemniscate-bloom" />+ )}+ <p className="text-sm text-muted-foreground">{label}</p>+ </div>+ </div>+ )+}diff --git a/apps/desktop/src/store/guide-opening.test.ts b/apps/desktop/src/store/guide-opening.test.tsindex de4139c3729..02ecd4e3386 100644--- a/apps/desktop/src/store/guide-opening.test.ts+++ b/apps/desktop/src/store/guide-opening.test.ts@@ -1,4 +1,23 @@-import { expect, it, vi } from 'vitest'+import { afterEach, expect, it, vi } from 'vitest'++afterEach(() => vi.unstubAllGlobals())++it('covers the pre-queue frame and a persisted guide until kickoff completes', async () => {+ vi.stubGlobal('hermesDesktop', { guestOnboardingEnabled: true })+ const { $guideOpening, $onboardingGate } = await import('./onboarding-gate')++ for (const phase of ['cinematic', 'guided'] as const) {+ $onboardingGate.set({ phase, guideQueued: false, guideKickoff: 'idle' })+ expect($guideOpening.get()).toBe(true)+ $onboardingGate.set({ phase, guideQueued: true, guideKickoff: 'starting' })+ expect($guideOpening.get()).toBe(true)+ $onboardingGate.set({ phase, guideQueued: false, guideKickoff: 'started' })+ expect($guideOpening.get()).toBe(false)+ }++ $onboardingGate.set({ phase: 'skipped', guideQueued: false, guideKickoff: 'idle' })+ expect($guideOpening.get()).toBe(false)+})it('keeps the opening visible through a shared kickoff and settles only after the seed is durable', async () => {vi.stubGlobal('hermesDesktop', { guestOnboardingEnabled: true })diff --git a/apps/desktop/src/store/onboarding-gate.ts b/apps/desktop/src/store/onboarding-gate.tsindex de7a1d78f02..c4cf71f914b 100644--- a/apps/desktop/src/store/onboarding-gate.ts+++ b/apps/desktop/src/store/onboarding-gate.ts@@ -48,7 +48,10 @@ let guideKickoff: GuideKickoff = { status: 'idle' }export const $guideOpening = computed([$onboardingGate, $introReveal],(gate, intro) =>- isOnboardingEnabled() && gate.guideQueued && intro.phase === 'hidden' && gate.guideKickoff !== 'started'+ isOnboardingEnabled() &&+ (gate.phase === 'cinematic' || gate.phase === 'guided') &&+ intro.phase === 'hidden' &&+ gate.guideKickoff !== 'started')function setGuideKickoff(state: GuideKickoff): void {