Skip to content

The agent that grows with you

fix(desktop): a relaunch mid-guide resumes the guide, in the guide's shape

brooklyn!548507c15084
diff --git a/apps/desktop/src/components/assistant-ui/ask-directive.tsx b/apps/desktop/src/components/assistant-ui/ask-directive.tsx
index e427024c198..9b011a7f3db 100644
--- a/apps/desktop/src/components/assistant-ui/ask-directive.tsx
+++ b/apps/desktop/src/components/assistant-ui/ask-directive.tsx
@@ -50,12 +50,23 @@ export function AskDirective({ attrs, streaming }: { attrs: Record<string, strin
const wantsInput = attrs.input === 'true' || attrs.input === 'yes'
const [picked, setPicked] = useState<null | string>(() => (settled.has(identity) ? '' : null))
+ // A typed reply answers the question too. The card only knew about its own
+ // buttons, so someone who answered in the composer came back to six live
+ // chips under a question they had already dealt with. Any user message
+ // after this one closes the ask.
+ const answeredInComposer = useStore(view.$messages).some(
+ (message, index, all) =>
+ message.role === 'user' && !message.hidden && index > all.findIndex(candidate => candidate.id === messageId)
+ )
+
+ const closed = picked !== null || answeredInComposer
+
if (!question || (options.length === 0 && !wantsInput)) {
return null
}
const submit = (value: string) => {
- if (picked !== null || streaming || !value.trim()) {
+ if (closed || streaming || !value.trim()) {
return
}
@@ -79,11 +90,11 @@ export function AskDirective({ attrs, streaming }: { attrs: Record<string, strin
'max-w-full shrink-0 rounded-full border px-3 py-1.5 text-left text-[12px] whitespace-normal wrap-anywhere transition-colors',
picked === option
? 'border-primary bg-primary text-primary-foreground'
- : picked !== null
+ : closed
? 'border-border/60 text-muted-foreground/50'
: 'border-border bg-card hover:border-primary/50 hover:bg-primary/10'
)}
- disabled={picked !== null || streaming}
+ disabled={closed || streaming}
key={option}
onClick={() => submit(option)}
type="button"
diff --git a/apps/desktop/src/components/gateway-connecting-overlay.tsx b/apps/desktop/src/components/gateway-connecting-overlay.tsx
index f95b9a963fb..462374bd7bc 100644
--- a/apps/desktop/src/components/gateway-connecting-overlay.tsx
+++ b/apps/desktop/src/components/gateway-connecting-overlay.tsx
@@ -6,6 +6,7 @@ import { prefersReducedMotion } from '@/hooks/use-media-query'
import { cn } from '@/lib/utils'
import { $desktopBoot } from '@/store/boot'
import { $gatewaySwitching } from '@/store/gateway-switch'
+import { guidedOnboardingActive } from '@/store/onboarding-gate'
import { $gatewayState } from '@/store/session'
// Decode mechanics live in the shared <DecodeText> primitive
@@ -132,6 +133,15 @@ export function GatewayConnectingOverlay() {
return null
}
+ // The guided first launch has its own opening (the film, then the typed
+ // greeting in a small window). "Connecting…" over it, then "Connected to
+ // localhost", is the app's boot narrating itself in the middle of the
+ // guide's; the guide's surface stays, this one yields. Boot progress still
+ // gates the transcript underneath — nothing paints early.
+ if (!previewing && guidedOnboardingActive()) {
+ return null
+ }
+
const leaving = phase !== 'live'
const overlayHidden = phase === 'overlay-out' || phase === 'gone'
diff --git a/apps/desktop/src/components/onboarding-chat/cards/build.tsx b/apps/desktop/src/components/onboarding-chat/cards/build.tsx
index 0a70352daab..a40b8fa1442 100644
--- a/apps/desktop/src/components/onboarding-chat/cards/build.tsx
+++ b/apps/desktop/src/components/onboarding-chat/cards/build.tsx
@@ -49,8 +49,17 @@ export function FirstBuildCard({ attrs, locked }: CardProps) {
const target = view.kind === 'tile' ? `tile:${storedId}` : 'main'
// The pick lives with the other answers, not in component state: the
// visible submit rebuilds the transcript and a local flag came back null,
- // leaving every chip clickable after one had already been sent.
- const picked = useStore($onboardingAnswers).committed.find(step => step.startsWith('first:'))?.slice(6) ?? null
+ // leaving every chip clickable after one had already been sent. A typed
+ // reply in the composer closes the card the same way a chip does.
+ const messageId = useAuiState(state => state.message.id)
+
+ const answeredInComposer = useStore(view.$messages).some(
+ (message, index, all) =>
+ message.role === 'user' && !message.hidden && index > all.findIndex(candidate => candidate.id === messageId)
+ )
+
+ const committed = useStore($onboardingAnswers).committed.find(step => step.startsWith('first:'))?.slice(6) ?? null
+ const picked = committed ?? (answeredInComposer ? '' : null)
// Parse + validate the model's options: up to 4, each short enough to sit on
// a chip, deduped case-insensitively (models repeat themselves). Garbage in
@@ -77,7 +86,7 @@ export function FirstBuildCard({ attrs, locked }: CardProps) {
const options = parsed.length < 2 ? [FALLBACK_OPTION] : parsed
const pick = (option: string) => {
- if (picked || locked) {
+ if (picked !== null || locked) {
return
}
diff --git a/apps/desktop/src/components/onboarding-chat/gate.tsx b/apps/desktop/src/components/onboarding-chat/gate.tsx
index 002b3f50254..e91282a3860 100644
--- a/apps/desktop/src/components/onboarding-chat/gate.tsx
+++ b/apps/desktop/src/components/onboarding-chat/gate.tsx
@@ -1,6 +1,7 @@
import { useStore } from '@nanostores/react'
import { useEffect } from 'react'
+import { startChatOnboardingSolo } 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'
@@ -17,6 +18,19 @@ export function OnboardingChatGate({ enabled, onKickoff, requestGateway }: Onboa
const gate = useStore($onboardingGate)
const intro = useStore($introReveal)
+ // 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
+ // 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?.()
+ }
+ // Once, on mount: the queued flag is a boot fact, not a live signal.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [])
+
useEffect(() => {
if (!enabled || !isOnboardingEnabled()) {
return
diff --git a/apps/desktop/src/store/onboarding-gate.ts b/apps/desktop/src/store/onboarding-gate.ts
index 1a622212501..6ec66f91599 100644
--- a/apps/desktop/src/store/onboarding-gate.ts
+++ b/apps/desktop/src/store/onboarding-gate.ts
@@ -28,7 +28,13 @@ function loadGate(): OnboardingGateState {
const phase = isOnboardingEnabled() && isOnboardingPhase(saved) ? saved : 'idle'
- return { phase, guideQueued: phase === 'cinematic' && hasSeenIntroReveal() }
+ // Two phases owe a kickoff at boot. `cinematic` with the film already seen
+ // is the film-to-guide seam. `guided` is a relaunch mid-guide: without a
+ // kickoff the normal app boots around the persisted solo layout — the
+ // connected splash, the stock composer and model picker, a small window
+ // whose sidebars cannot open — while the gate still says the guide is on.
+ // The kickoff adopts the existing guide chat by title, so nothing is lost.
+ return { phase, guideQueued: (phase === 'cinematic' && hasSeenIntroReveal()) || phase === 'guided' }
}
export const $onboardingGate = atom<OnboardingGateState>(loadGate())