Skip to content

The agent that grows with you

fix(desktop): the guide takes its shape on the tick the film ends, not after the window shows

brooklyn!546b4d4469c8
diff --git a/apps/desktop/src/app/contrib/onboarding-kickoff.ts b/apps/desktop/src/app/contrib/onboarding-kickoff.ts
index 4406e991498..cfddff75685 100644
--- a/apps/desktop/src/app/contrib/onboarding-kickoff.ts
+++ b/apps/desktop/src/app/contrib/onboarding-kickoff.ts
@@ -6,7 +6,7 @@ import {
$chatOnboardingThreadIds,
endChatOnboardingSolo,
pickOnboardingGreeting,
- startChatOnboardingSolo
+ takeGuideShape
} from '@/components/onboarding-chat/assembly'
import {
$setupSession,
@@ -114,8 +114,9 @@ export function useOnboardingKickoff({
$newChatProfile.set(SETUP_PROFILE)
await ensureGatewayProfile(SETUP_PROFILE)
- startChatOnboardingSolo()
- window.hermesDesktop?.chatOnboarding?.soloBoot?.()
+ // Idempotent: the gate already took the shape on the tick the guide was
+ // owed, so no full-size shell painted during the profile round trips.
+ takeGuideShape()
await loadMachineProfile()
const seedMessages = buildChatOnboardingSeedMessages(pickOnboardingGreeting(), record.free_tier !== true)
diff --git a/apps/desktop/src/components/intro-reveal/index.tsx b/apps/desktop/src/components/intro-reveal/index.tsx
index 223aadded53..0b5579d7088 100644
--- a/apps/desktop/src/components/intro-reveal/index.tsx
+++ b/apps/desktop/src/components/intro-reveal/index.tsx
@@ -1,6 +1,7 @@
import { useStore } from '@nanostores/react'
import { useEffect } from 'react'
+import { takeGuideShape } from '@/components/onboarding-chat/assembly'
import {
$introReveal,
finishIntroReveal,
@@ -36,10 +37,12 @@ export function IntroRevealGate({ enabled }: IntroRevealGateProps) {
}
// Observe the store edge directly: a failed native open can finish before
- // React renders the playing phase.
+ // React renders the playing phase. Take the guide's shape on the same
+ // tick — finishIntroReveal shows the main window right after this fires.
return $introReveal.listen((state, previous) => {
if (state.phase === 'hidden' && previous?.phase !== 'hidden') {
queueGuideAfterIntro()
+ takeGuideShape()
}
})
}, [enabled])
diff --git a/apps/desktop/src/components/onboarding-chat/assembly.ts b/apps/desktop/src/components/onboarding-chat/assembly.ts
index 379a58229c0..42438d70a79 100644
--- a/apps/desktop/src/components/onboarding-chat/assembly.ts
+++ b/apps/desktop/src/components/onboarding-chat/assembly.ts
@@ -65,6 +65,22 @@ export const $chatLayoutPicked = atom(false)
let previousLayout: { id: string; tree: LayoutNode | null } | null = null
+/** The guide's shape, all at once: the solo layout and the small centred
+ * window. Called on the tick the guide is owed (film ended, or a boot that
+ * finds the guide queued) so no full-size frame paints in between. */
+export function takeGuideShape(): void {
+ if ($chatOnboardingSolo.get()) {
+ return
+ }
+
+ startChatOnboardingSolo()
+
+ // startChatOnboardingSolo declines when the guide is off; shrink only when it took.
+ if ($chatOnboardingSolo.get()) {
+ window.hermesDesktop?.chatOnboarding?.soloBoot?.()
+ }
+}
+
export function startChatOnboardingSolo(): void {
if (!isOnboardingEnabled() || $chatOnboardingSolo.get()) {
return
diff --git a/apps/desktop/src/components/onboarding-chat/gate.tsx b/apps/desktop/src/components/onboarding-chat/gate.tsx
index e91282a3860..de0c0351329 100644
--- a/apps/desktop/src/components/onboarding-chat/gate.tsx
+++ b/apps/desktop/src/components/onboarding-chat/gate.tsx
@@ -1,7 +1,7 @@
import { useStore } from '@nanostores/react'
import { useEffect } from 'react'
-import { startChatOnboardingSolo } from '@/components/onboarding-chat/assembly'
+import { takeGuideShape } from '@/components/onboarding-chat/assembly'
import { isOnboardingEnabled } from '@/lib/onboarding-enabled'
import { ackFreeTierNotice, type FreeTierRequester } from '@/store/free-tier'
import { $introReveal } from '@/store/intro-reveal'
@@ -23,9 +23,8 @@ export function OnboardingChatGate({ enabled, onKickoff, requestGateway }: Onboa
// gateway opens — otherwise the normal shell paints at full size for the
// seconds the backend takes to come up, and then snaps down to the guide.
useEffect(() => {
- if (isOnboardingEnabled() && gate.guideQueued && intro.phase === 'hidden') {
- startChatOnboardingSolo()
- window.hermesDesktop?.chatOnboarding?.soloBoot?.()
+ if (gate.guideQueued && intro.phase === 'hidden') {
+ takeGuideShape()
}
// Once, on mount: the queued flag is a boot fact, not a live signal.
// eslint-disable-next-line react-hooks/exhaustive-deps
diff --git a/apps/desktop/src/store/intro-reveal.ts b/apps/desktop/src/store/intro-reveal.ts
index 076442b70db..8b37dfed4ed 100644
--- a/apps/desktop/src/store/intro-reveal.ts
+++ b/apps/desktop/src/store/intro-reveal.ts
@@ -62,6 +62,10 @@ export function finishIntroReveal(): void {
writeKey(SEEN_KEY, '1')
$introReveal.set(INITIAL)
+ // The gate's listener on that edge queues the guide and takes the solo
+ // shape (small window, greeting layout) synchronously, so the main window
+ // is already the guide when it is shown. Showing first and shrinking after
+ // is what flashed the full app between the film and the greeting.
void window.hermesDesktop?.introReveal?.close({ showMain: true }).catch(() => undefined)
}