The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
P18b: first-run intro — boot into the setup chat, hidden /initiate-setup, leave/Skip, Reset onboarding (#129318)
Siddharth Balyan9756ef269c80
diff --git a/apps/desktop/src/app/chat/composer/index.tsx b/apps/desktop/src/app/chat/composer/index.tsxindex b3ca5ca23d1..c56ddbf953f 100644--- a/apps/desktop/src/app/chat/composer/index.tsx+++ b/apps/desktop/src/app/chat/composer/index.tsx@@ -33,6 +33,7 @@ import { POPOUT_WIDTH_REM } from '@/store/composer-popout'import { parkQueuedPrompts, removeQueuedPrompt, unparkQueuedPrompts } from '@/store/composer-queue'import { $hudMode } from '@/store/hud'import { $showsAdvancedChrome } from '@/store/interface-mode'+import { $chatOnboardingSolo } from '@/store/onboarding-intro'import { sessionBlockingPrompt } from '@/store/prompts'import { toggleReview } from '@/store/review'import { $gatewayState } from '@/store/session'@@ -217,8 +218,10 @@ export function ChatBar({// The guide uses the setup profile's inference route; the model pill and// git controls would expose settings unrelated to its conversational steps.- // Solo covers startup before the guide's session ids are known.+ // Solo covers startup before the guide's session ids are known. Once the intro has ended the setup+ // chat is a normal chat again.const guidedChat = useSetupChatView()+ const chatOnboardingSolo = useStore($chatOnboardingSolo)// The git row (branch / worktree / PR / review) is the coding instrument the// guide already hides; Simple mode hides it for the same reason, everywhere.const showsAdvancedChrome = useStore($showsAdvancedChrome)@@ -1152,7 +1155,7 @@ export function ChatBar({foldVoice={foldVoice}hasComposerPayload={hasComposerPayload}hideModelPill={guidedChat}- minimal={minimal}+ minimal={minimal || chatOnboardingSolo}onDictate={dictate}onQueue={queueDraft}onToggleAutoSpeak={handleToggleAutoSpeak}diff --git a/apps/desktop/src/app/chat/index.tsx b/apps/desktop/src/app/chat/index.tsxindex 5f0a4c5c099..2b6519261da 100644--- a/apps/desktop/src/app/chat/index.tsx+++ b/apps/desktop/src/app/chat/index.tsx@@ -14,6 +14,7 @@ import { TranscriptWindowProvider } from '@/components/assistant-ui/thread/transimport { Backdrop } from '@/components/Backdrop'import { COMPOSER_HEART_CONFIG, HeartField } from '@/components/chat/vibe-hearts'import { useSetupChatView } from '@/components/onboarding-chat/assembly'+import { IntroCopy } from '@/components/onboarding-chat/intro-copy'import { usePaneGroup, usePaneVisible } from '@/components/pane-shell/pane-visibility'import { $hoveredTreeGroup, $sessionTileDragging, $sessionTileEdgeHover } from '@/components/pane-shell/tree/store'import { PromptOverlays } from '@/components/prompt-overlays'@@ -52,7 +53,7 @@ import {} from '@/store/session'import { $focusedStoredSessionId, $sessionStates, sessionTileDelegate } from '@/store/session-states'import { $transcriptTailBySessionId, transcriptTailState } from '@/store/transcript-tail'-import { isAuxiliaryWindow, isWatchWindow } from '@/store/windows'+import { isAuxiliaryWindow, isMainWindow, isWatchWindow } from '@/store/windows'import { primaryRouteSelectedSessionId, routeSessionId } from '../routes'import { titlebarHeaderBaseClass, titlebarHeaderShadowClass, titlebarHeaderTitleClass } from '../shell/titlebar'@@ -856,6 +857,7 @@ const ChatViewContent = memo(function ChatViewContent({sessionKey={threadKey}/>)}+ {isPrimary && isMainWindow() && <IntroCopy />}{resumeExhausted && routedSessionId && (<ResumeExhaustedOverlay onRetryResume={onRetryResume} sessionId={routedSessionId} />)}diff --git a/apps/desktop/src/app/command-palette/index.tsx b/apps/desktop/src/app/command-palette/index.tsxindex a0131d66c90..7016f6bc7ec 100644--- a/apps/desktop/src/app/command-palette/index.tsx+++ b/apps/desktop/src/app/command-palette/index.tsx@@ -14,6 +14,7 @@ import {HUD_TEXT} from '@/app/floating-hud'import { SESSION_IMPORT_ROUTE } from '@/app/routes'+import { leaveIntro } from '@/components/onboarding-chat/intro'import { codiconIcon } from '@/components/ui/codicon'import { Command, CommandGroup, CommandInput, CommandItem, CommandList } from '@/components/ui/command'import { HighlightMatches } from '@/components/ui/highlight-matches'@@ -1568,6 +1569,8 @@ function CommandPaletteBody({ onExited }: { onExited: () => void }) {completeFlow('command_palette')recordAction(item.action ?? 'other', 'palette')+ // A Cmd-K command or layout is a way out of the first-run intro.+ leaveIntro()if (item.runWithEvent) {item.runWithEvent(lastSelectMods.current)diff --git a/apps/desktop/src/app/contrib/layout-presets.ts b/apps/desktop/src/app/contrib/layout-presets.tsindex 0ed3dafa14a..843a87242b7 100644--- a/apps/desktop/src/app/contrib/layout-presets.ts+++ b/apps/desktop/src/app/contrib/layout-presets.ts@@ -81,6 +81,12 @@ const TERMINAL_TREE = split(// reading open while nothing shows.const TERMINAL_RESTING = ['terminal', 'files', 'review'] as const+// The first-run intro's borrowed layout: the chat alone, no tab strip. Unlisted,+// and applied while layout persistence is held (onboarding-chat/assembly.ts).+export const DEMO_LAYOUT_ID = 'demo'++export const DEMO_TREE = group(['workspace'], { tabStrip: 'never' })+const QUAD_TREE = split('column',[@@ -114,6 +120,7 @@ export function registerLayoutPresets() {resting: TERMINAL_RESTING,tier: 'advanced'},- { id: 'quad', title: 'Quad', order: 30, tree: QUAD_TREE, tier: 'advanced' }+ { id: 'quad', title: 'Quad', order: 30, tree: QUAD_TREE, tier: 'advanced' },+ { id: DEMO_LAYOUT_ID, listed: false, title: 'Demo', order: 40, tree: DEMO_TREE }])}diff --git a/apps/desktop/src/app/contrib/onboarding-kickoff.ts b/apps/desktop/src/app/contrib/onboarding-kickoff.tsindex ee13cd9d8cb..03f5549b508 100644--- a/apps/desktop/src/app/contrib/onboarding-kickoff.ts+++ b/apps/desktop/src/app/contrib/onboarding-kickoff.ts@@ -2,23 +2,17 @@ import type { OnboardingEnsureSetupProfileResult, OnboardingEnsureSetupSessionReimport { useCallback } from 'react'import type { useSessionActions } from '@/app/session/hooks/use-session-actions'-import {- $chatOnboardingThreadIds,- endChatOnboardingSolo,- pickOnboardingGreeting,- takeGuideShape-} from '@/components/onboarding-chat/assembly'-import { $setupSession, guideSourceConnectionId, SETUP_CHAT_TITLE } from '@/components/onboarding-chat/setup-profile'-import { chatMessageText } from '@/lib/chat-messages'+import { $chatOnboardingThreadIds, endChatOnboardingSolo, takeGuideShape } from '@/components/onboarding-chat/assembly'+import { $introTurnSent, openIntro, rememberLaunchSource } from '@/components/onboarding-chat/intro'+import { $setupSession, guideSourceConnectionId } from '@/components/onboarding-chat/setup-profile'+import type { ChatMessagePart } from '@/lib/chat-messages'import { isOnboardingEnabled } from '@/lib/onboarding-enabled'import { prefetchConnectorCatalog } from '@/store/connector-catalog'import { activeGatewayConnectionId, requestGatewayForProfile } from '@/store/gateway'-import { loadMachineProfile } from '@/store/machine'import { notify } from '@/store/notifications'-import { readOnboardingCapabilities } from '@/store/onboarding-capabilities'import { $setupProfileName, type GuideKickoffResult } from '@/store/onboarding-gate'+import { $introView } from '@/store/onboarding-intro'import { prefetchOnboardingPlugins } from '@/store/onboarding-plugins'-import { buildChatOnboardingSeedMessages } from '@/store/onboarding-script'import {$activeGatewayProfile,$newChatProfile,@@ -26,7 +20,7 @@ import {ensureGatewayAgent,ensureGatewayProfile} from '@/store/profile'-import { $activeSessionId, $messages, $selectedStoredSessionId } from '@/store/session'+import { $activeSessionId, $selectedStoredSessionId } from '@/store/session'import { $sessionStates } from '@/store/session-states'import type { AmbientGatewayRequest } from './session-rpc-dispatcher'@@ -38,8 +32,12 @@ function prefetchGuideCatalogs(storedId: null | string): void {}}+/** Runs a slash command as if typed; `hidden` keeps its user row out of every transcript. */+export type KickoffSlashCommand = (command: string, options: { hidden: true; sessionId: string }) => Promise<void>+export interface OnboardingKickoffOptions extends Pick<ReturnType<typeof useSessionActions>, 'resumeSession'> {requestGateway: AmbientGatewayRequest+ runSlashCommand: KickoffSlashCommand}interface SetupStatus {@@ -48,42 +46,64 @@ interface SetupStatus {free_tier_route?: boolean}-interface GuideSession {- id: string- message_count?: number- resolved_id?: string+const answeredSetupCard = (part: ChatMessagePart) =>+ part.type === 'tool-call' && part.toolName === 'setup_choose' && part.result !== undefined++/**+ * Where the setup chat's opening stands after a relaunch. `blank`: no assistant words yet. `stalled`: no+ * live turn, and nothing after the last answered card drives the chat on — the backend's name and accent+ * cards were not both answered, or the model never spoke after the last answer (the app quit mid-turn).+ */+function setupChatOpening(runtimeId: string): { blank: boolean; stalled: boolean } {+ const state = $sessionStates.get()[runtimeId]+ const parts = (state?.messages ?? []).filter(m => m.role === 'assistant' && !m.hidden).flatMap(m => m.parts)+ const blank = !parts.some(part => part.type === 'text' && part.text.trim())++ if (!state || state.busy || state.awaitingResponse || state.turnLive || state.needsInput) {+ return { blank, stalled: false }+ }++ const answers = parts.flatMap((part, index) => (answeredSetupCard(part) ? [index] : []))++ if (answers.length < 2) {+ return { blank, stalled: true }+ }++ const spoke = parts+ .slice(answers[answers.length - 1] + 1)+ .some(part => part.type === 'tool-call' || (part.type === 'text' && part.text.trim()))++ return { blank, stalled: !spoke }}export async function adoptGuideSession(setupProfile: string,- canonical: GuideSession,+ storedId: string,freeTierRoute: SetupStatus['free_tier_route'],resumeSession: OnboardingKickoffOptions['resumeSession'],guideRequest: AmbientGatewayRequest-): Promise<void> {- await resumeSession(canonical.resolved_id ?? canonical.id, true)+): Promise<string> {+ await resumeSession(storedId, true)const adoptedRuntimeId = $activeSessionId.get()const state = adoptedRuntimeId ? $sessionStates.get()[adoptedRuntimeId] : undefinedif (!adoptedRuntimeId ||!state?.storedSessionId ||- ![canonical.id, canonical.resolved_id].includes(state.storedSessionId) ||$selectedStoredSessionId.get() !== state.storedSessionId ||- $activeGatewayProfile.get() !== setupProfile ||- !$messages.get().some(message => message.role === 'assistant' && !message.hidden && chatMessageText(message).trim())+ $activeGatewayProfile.get() !== setupProfile) {throw new Error('The welcome conversation could not be loaded. Please try again.')}- $chatOnboardingThreadIds.set([canonical.id, adoptedRuntimeId])+ $chatOnboardingThreadIds.set([...new Set([storedId, state.storedSessionId, adoptedRuntimeId])])$setupSession.set({- connectionId: guideSourceConnectionId(canonical.id),+ connectionId: guideSourceConnectionId(storedId),profile: setupProfile,runtimeId: adoptedRuntimeId,- storedId: canonical.id+ storedId})- prefetchGuideCatalogs(canonical.id)+ prefetchGuideCatalogs(storedId)if (freeTierRoute) {await guideRequest('config.set', {@@ -92,9 +112,11 @@ export async function adoptGuideSession(value: 'minimal'})}++ return adoptedRuntimeId}-export function useOnboardingKickoff({ requestGateway, resumeSession }: OnboardingKickoffOptions) {+export function useOnboardingKickoff({ requestGateway, resumeSession, runSlashCommand }: OnboardingKickoffOptions) {return useCallback(async (): Promise<GuideKickoffResult> => {if (!isOnboardingEnabled()) {return 'off'@@ -122,53 +144,51 @@ export function useOnboardingKickoff({ requestGateway, resumeSession }: Onboardireturn 'off'}+ // The gate gave up waiting (its deadline): the app is already on its normal layout.+ const stillStarting = () => {+ if ($introView.get() !== 'starting') {+ throw new Error('The welcome chat took too long to open.')+ }+ }++ stillStarting()+ takeGuideShape()+ rememberLaunchSource()swapped = true$newChatRoute.set(null)$newChatProfile.set(setupProfile)await ensureGatewayProfile(setupProfile)-- takeGuideShape()- await loadMachineProfile()+ stillStarting()const guideRequest: AmbientGatewayRequest = (method, params, timeout) =>requestGatewayForProfile(setupProfile, method, params, timeout)- const registryHit = await guideRequest<{ sessions?: GuideSession[] }>('session.list', {- include_hidden: true,- title: SETUP_CHAT_TITLE- })-- const canonical = registryHit?.sessions?.[0]-- if (canonical?.message_count) {- await adoptGuideSession(setupProfile, canonical, record.free_tier_route, resumeSession, guideRequest)-- return 'started'- }-- const capabilities = await readOnboardingCapabilities({- connectionId: previousConnectionId,- profile: setupProfile- })-- const seedMessages = buildChatOnboardingSeedMessages(- pickOnboardingGreeting(),- record.free_tier_route !== true,- capabilities- )+ // Finds the setup chat by title or creates it; `empty` is true only before its first turn.+ const setupChat = await requestGateway<OnboardingEnsureSetupSessionResult>('onboarding.ensure_setup_session', {})- const setupChat = await requestGateway<OnboardingEnsureSetupSessionResult>('onboarding.ensure_setup_session', {- messages: seedMessages- })-- await adoptGuideSession(+ const runtimeId = await adoptGuideSession(setupProfile,- { id: setupChat.session_id },+ setupChat.session_id,record.free_tier_route,resumeSession,guideRequest)+ stillStarting()++ // A relaunch reopens the same setup chat; one whose opening was cut off is sent the command again.+ const opening = setupChat.empty ? { blank: true, stalled: true } : setupChatOpening(runtimeId)++ openIntro(opening.blank)+ $introTurnSent.set(!opening.stalled)++ if (opening.stalled) {+ // The skill turn: the backend plays the fixed cards, then the model takes over.+ void runSlashCommand('/initiate-setup', { hidden: true, sessionId: runtimeId }).finally(() =>+ $introTurnSent.set(true)+ )+ }+return 'started'} catch (error) {$newChatProfile.set(previousNewChatProfile)@@ -196,5 +216,5 @@ export function useOnboardingKickoff({ requestGateway, resumeSession }: Onboardireturn 'failed'}- }, [requestGateway, resumeSession])+ }, [requestGateway, resumeSession, runSlashCommand])}diff --git a/apps/desktop/src/app/contrib/surfaces.tsx b/apps/desktop/src/app/contrib/surfaces.tsxindex f556fe1c979..69030626005 100644--- a/apps/desktop/src/app/contrib/surfaces.tsx+++ b/apps/desktop/src/app/contrib/surfaces.tsx@@ -16,6 +16,7 @@ import { useContributions } from '@/contrib/react/use-contributions'import { $activeConnectionId } from '@/store/connections'import { $gateway } from '@/store/gateway'import { $guideOpening } from '@/store/onboarding-gate'+import { $chatOnboardingSolo } from '@/store/onboarding-intro'import { $activeGatewayProfile } from '@/store/profile'import { $freshDraftReady, $gatewayState } from '@/store/session'@@ -84,6 +85,7 @@ export const StatusbarSurface = memo(function StatusbarSurface({const activeGatewayProfile = useStore($activeGatewayProfile)const gatewayState = useStore($gatewayState)const guideOpening = useStore($guideOpening)+ const demoLayout = useStore($chatOnboardingSolo)const freshDraftReady = useStore($freshDraftReady)const gatewayScope = `${activeConnectionId ?? ''}\0${activeGatewayProfile}`const { inferenceStatus, statusSnapshot } = useStatusSnapshot(gatewayState, actions.requestGateway, gatewayScope)@@ -106,7 +108,8 @@ export const StatusbarSurface = memo(function StatusbarSurface({toggleCommandCenter: actions.toggleCommandCenter})- return guideOpening ? null : <StatusbarControls items={statusbarItems} leftItems={leftStatusbarItems} />+ // The demo layout (first-run intro) has no status bar.+ return guideOpening || demoLayout ? null : <StatusbarControls items={statusbarItems} leftItems={leftStatusbarItems} />})/** The workspace pane: the real route table (chat + full-page views + plugindiff --git a/apps/desktop/src/app/contrib/wiring.tsx b/apps/desktop/src/app/contrib/wiring.tsxindex fda72e44bf8..167a8ddb56a 100644--- a/apps/desktop/src/app/contrib/wiring.tsx+++ b/apps/desktop/src/app/contrib/wiring.tsx@@ -92,7 +92,7 @@ import { reportPendingUpdateRun } from '@/store/shared-metrics'import { $archivedSessions } from '@/store/sidebar-archive'import { $titlebarAppActionsSide, titlebarAppActionsClusterCounts } from '@/store/titlebar-app-actions'import { armWakeWord, stopClientCapture } from '@/store/wake-word'-import { isAuxiliaryWindow, isBrowserWindow, isHudWindow } from '@/store/windows'+import { isAuxiliaryWindow, isBrowserWindow, isHudWindow, isMainWindow } from '@/store/windows'import { useSkinCommand } from '@/themes/use-skin-command'import type { SessionInfo } from '@/types/hermes'@@ -169,7 +169,7 @@ import { useQuickEntryBridge } from './hooks/use-quick-entry-bridge'import { useSessionTileDelegate } from './hooks/use-session-tile-delegate'import { McpInstallDeepLinkDialog } from './mcp-install-deeplink-dialog'import { useOnboardingHandoff } from './onboarding-handoff'-import { useOnboardingKickoff } from './onboarding-kickoff'+import { type KickoffSlashCommand, useOnboardingKickoff } from './onboarding-kickoff'import { $restartPreviewServer, useTitlebarToolContributions } from './panes'import { type AmbientGatewayRequest, createSessionRpcDispatcher } from './session-rpc-dispatcher'import { ChatRoutesSurface, SidebarSurface, StatusbarSurface, TerminalSurface } from './surfaces'@@ -707,11 +707,6 @@ export function ContribWiring({ children }: { children: ReactNode }) {[navigate, resumeSession])- const kickoffFirstChat = useOnboardingKickoff({- requestGateway: ambientRequestGateway,- resumeSession: adoptSessionRoute- })-useOnboardingHandoff({activeSessionIdRef,ensureSessionState,@@ -795,6 +790,17 @@ export function ContribWiring({ children }: { children: ReactNode }) {updateSessionState})+ const runKickoffSlash = useCallback<KickoffSlashCommand>(+ (command, options) => executeSlashCommand(command, { ...options, typed: false }),+ [executeSlashCommand]+ )++ const kickoffFirstChat = useOnboardingKickoff({+ requestGateway: ambientRequestGateway,+ resumeSession: adoptSessionRoute,+ runSlashCommand: runKickoffSlash+ })+// Runs outside the selected ChatBar so queues belonging to background// sessions continue once those sessions are idle.useBackgroundQueueDrain({@@ -1371,7 +1377,7 @@ export function ContribWiring({ children }: { children: ReactNode }) {{/* The full real overlay set (mirrors DesktopController's `overlays`). */}<RemoteDisplayBanner />{!isAuxiliaryWindow() && <DesktopInstallOverlay />}- {!isAuxiliaryWindow() && (+ {isMainWindow() && (<OnboardingChatGateenabled={gatewayState === 'open'}onKickoff={kickoffFirstChat}diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/tools.ts b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/tools.tsindex 35aed4a0063..0e8393329b6 100644--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/tools.ts+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/tools.ts@@ -1,5 +1,6 @@import { isPreviewableTarget, toolPreviewOutcome } from '@/components/assistant-ui/tool/fallback-model'import { reportFirstBuildToolComplete } from '@/components/onboarding-chat/first-build'+import { finishGuidedOnboarding } from '@/components/onboarding-chat/intro'import { toolCallOwnerMessageId } from '@/lib/chat-messages'import { invalidateSlashCompletions } from '@/lib/slash-completion-cache'import { refreshBackgroundProcesses } from '@/store/composer-status'@@ -104,10 +105,14 @@ export function handleToolEvent(ctx: GatewayEventContext): boolean {if (!event.replayed &&payload?.name === 'start_chat' &&- readStartChatResult(payload.result)?.status === 'started' &&- isStartChatCallerWatched(storedSessionIdForRuntimeId(sessionId) ?? sessionId)+ readStartChatResult(payload.result)?.status === 'started') {- markLiveStartChat(payload.tool_id || payload.tool_call_id || payload.id || '')+ if (isStartChatCallerWatched(storedSessionIdForRuntimeId(sessionId) ?? sessionId)) {+ markLiveStartChat(payload.tool_id || payload.tool_call_id || payload.id || '')+ }++ // From the setup chat, the handoff completes the guided first run (no-op elsewhere).+ finishGuidedOnboarding(sessionId)}if (isActiveEvent) {diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.ts b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.tsindex 1ef9e1dab51..d0215ab726b 100644--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.ts+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.ts@@ -190,7 +190,10 @@ export function useSlashCommand(deps: SlashCommandDeps) {const compressInFlightRef = useRef(new Set<string>())return useCallback(- async (rawCommand: string, options?: { sessionId?: string; recordInput?: boolean; typed?: boolean }) => {+ async (+ rawCommand: string,+ options?: { hidden?: boolean; sessionId?: string; recordInput?: boolean; typed?: boolean }+ ) => {// Resolve the session this command targets through the SHARED ladder that// submit.ts uses. A slash command runs backend commands against a runtime// session, and per-session state (`/goal`, `/usage`, `/status`) is keyed by@@ -379,7 +382,14 @@ export function useSlashCommand(deps: SlashCommandDeps) {// its kickoff as a user message into whatever conversation was on// screen. Every other target the dispatcher serves (tile, background// queue drain, a session created by this very call) had the same leak.- await submitPromptText(message, { sessionId, storedSessionId, displayText })+ // `hidden` (the first-run `/initiate-setup`) types the saved user row hidden: no bubble, live+ // or after a reload.+ await submitPromptText(message, {+ sessionId,+ storedSessionId,+ displayText,+ ...(options?.hidden && { displayKind: 'hidden' as const })+ })}try {diff --git a/apps/desktop/src/app/settings/config-settings.tsx b/apps/desktop/src/app/settings/config-settings.tsxindex 39f5e643061..4f7470a4348 100644--- a/apps/desktop/src/app/settings/config-settings.tsx+++ b/apps/desktop/src/app/settings/config-settings.tsx@@ -36,6 +36,7 @@ import { PanelEmpty } from '../overlays/panel'import { ConfigField } from './config-field'import { configSubpageForField } from './config-subpages'+import { DeveloperSettings } from './developer-settings'import {clearsEnabledToolsets,diffConfig,@@ -469,6 +470,7 @@ function ConfigSettingsInner({/><PoolLimitsSetting /><QuickEntrySettings />+ <DeveloperSettings /></>)}{/* Device-local attach/preview byte cap (main-process IPC guard). Chat isdiff --git a/apps/desktop/src/app/settings/developer-settings.tsx b/apps/desktop/src/app/settings/developer-settings.tsxnew file mode 100644index 00000000000..97167aea042--- /dev/null+++ b/apps/desktop/src/app/settings/developer-settings.tsx@@ -0,0 +1,50 @@+import { useState } from 'react'++import { useGatewayRequest } from '@/app/gateway/hooks/use-gateway-request'+import { Button } from '@/components/ui/button'+import { useI18n } from '@/i18n'+import { Wrench } from '@/lib/icons'+import { isOnboardingEnabled } from '@/lib/onboarding-enabled'+import { notifyError } from '@/store/notifications'+import { resetOnboarding } from '@/store/onboarding-gate'++import { ListRow, SettingsSection } from './primitives'++/** Advanced → Developer. Only builds with the guided first run have anything here. */+export function DeveloperSettings() {+ const { t } = useI18n()+ const c = t.settings.config+ const [resetting, setResetting] = useState(false)+ const { requestGateway } = useGatewayRequest()++ if (!isOnboardingEnabled()) {+ return null+ }++ const reset = async () => {+ setResetting(true)++ try {+ await resetOnboarding(requestGateway)+ // A fresh window runs the first run from zero, starting screen included.+ window.location.reload()+ } catch (error) {+ notifyError(error, c.resetOnboardingFailed)+ setResetting(false)+ }+ }++ return (+ <SettingsSection icon={Wrench} title={c.developerTitle}>+ <ListRow+ action={+ <Button disabled={resetting} onClick={() => void reset()} size="sm" variant="outline">+ {c.resetOnboardingAction}+ </Button>+ }+ description={c.resetOnboardingDesc}+ title={c.resetOnboardingTitle}+ />+ </SettingsSection>+ )+}diff --git a/apps/desktop/src/components/gateway-connecting-overlay.tsx b/apps/desktop/src/components/gateway-connecting-overlay.tsxindex f6c4093c9ae..ccee6c4d695 100644--- a/apps/desktop/src/components/gateway-connecting-overlay.tsx+++ b/apps/desktop/src/components/gateway-connecting-overlay.tsx@@ -3,11 +3,14 @@ import { useEffect, useRef, useState } from 'react'import { DecodeText } from '@/components/ui/decode-text'import { prefersReducedMotion } from '@/hooks/use-media-query'+import { isOnboardingEnabled } from '@/lib/onboarding-enabled'import { cn } from '@/lib/utils'import { $desktopBoot } from '@/store/boot'import { $gatewaySwitching } from '@/store/gateway-switch'-import { guidedOnboardingActive } from '@/store/onboarding-gate'+import { $onboardingStateRead } from '@/store/onboarding-gate'+import { $introView } from '@/store/onboarding-intro'import { $gatewayState } from '@/store/session'+import { isMainWindow } from '@/store/windows'// Decode mechanics live in the shared <DecodeText> primitive// (components/ui/decode-text.tsx). "CONN" stays legible via prefix={4}.@@ -41,6 +44,8 @@ export function GatewayConnectingOverlay() {const gatewayState = useStore($gatewayState)const boot = useStore($desktopBoot)const gatewaySwitching = useStore($gatewaySwitching)+ const onboardingStateRead = useStore($onboardingStateRead)+ const introView = useStore($introView)const [previewing] = useState(forcedPreview)const reduce = prefersReducedMotion()// Under reduced motion, skip the multi-phase exit choreography (text-out →@@ -75,6 +80,11 @@ export function GatewayConnectingOverlay() {shownRef.current = true}+ // The first-run intro's `starting` screen is this overlay: it stays up until the backend says+ // whether the intro runs and, if it does, until the setup chat is open.+ const introHolds =+ !previewing && isMainWindow() && isOnboardingEnabled() && (!onboardingStateRead || introView === 'starting')+// Kick off the exit when connected: real connect, or a faked timer in preview.useEffect(() => {if (phase !== 'live') {@@ -87,14 +97,14 @@ export function GatewayConnectingOverlay() {return () => window.clearTimeout(id)}- if (gatewayState === 'open' && shownRef.current) {+ if (gatewayState === 'open' && shownRef.current && !introHolds) {// Under reduced motion, skip the multi-phase exit choreography// (text-out → hold → overlay fade) and jump straight to gone so the// overlay unmounts the instant the gateway opens. E2E screenshots// rely on this to avoid catching the overlay mid-fade.setPhase(reduce ? 'gone' : 'text-out')}- }, [phase, previewing, gatewayState, reduce])+ }, [phase, previewing, gatewayState, introHolds, reduce])// Advance the exit choreography: text-out -> overlay-out -> gone.useEffect(() => {@@ -133,15 +143,6 @@ export function GatewayConnectingOverlay() {return null}- // The guided first launch has its own opening (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/assembly.ts b/apps/desktop/src/components/onboarding-chat/assembly.tsindex 8dd0fac4148..183e608424e 100644--- a/apps/desktop/src/components/onboarding-chat/assembly.ts+++ b/apps/desktop/src/components/onboarding-chat/assembly.ts@@ -2,7 +2,8 @@ import { useStore } from '@nanostores/react'import { atom } from 'nanostores'import { useSessionView } from '@/app/chat/session-view'-import { allPaneIds, group, type LayoutNode } from '@/components/pane-shell/tree/model'+import { DEMO_LAYOUT_ID, DEMO_TREE } from '@/app/contrib/layout-presets'+import { allPaneIds, type LayoutNode } from '@/components/pane-shell/tree/model'import { applyLayoutPreset } from '@/components/pane-shell/tree/presets'import {$activePresetId,@@ -16,41 +17,22 @@ import {undismissTreePanes} from '@/components/pane-shell/tree/store'import { registry } from '@/contrib/registry'-import { runtimeTranslations } from '@/i18n/runtime'import { isOnboardingEnabled } from '@/lib/onboarding-enabled'import { useStoreSelector } from '@/lib/use-session-slice'-import { $interfaceMode, type InterfaceMode, setInterfaceMode } from '@/store/interface-mode'+import { $interfaceMode, type InterfaceMode, modeLayout, setInterfaceMode } from '@/store/interface-mode'import { setSidebarOpen } from '@/store/layout'-import { loadMachineProfile, machineUserName } from '@/store/machine'-import { skipGuide } from '@/store/onboarding-gate'-import { setOnboardingSurfaceActive } from '@/store/onboarding-presence'+import { $chatOnboardingSolo, $introView } from '@/store/onboarding-intro'import { $paneStates, type PaneStateSnapshot } from '@/store/panes'import { $activeSessionId, $selectedStoredSessionId } from '@/store/session'-export const $chatOnboardingSolo = atom(false)--$chatOnboardingSolo.subscribe(solo => setOnboardingSurfaceActive('solo-chat', solo))+// The demo is borrowed: nothing it changes is persisted as the user's layout.+$chatOnboardingSolo.subscribe(solo => {+ modeLayout.hold(solo)+ document.documentElement.toggleAttribute('data-onboarding-demo', solo)+})export const $chatOnboardingThreadIds = atom<readonly string[]>([])-export const $onboardingGreeting = atom('')--export function pickOnboardingGreeting(): string {- const existing = $onboardingGreeting.get()-- if (existing) {- return existing- }-- const copy = runtimeTranslations().guidedGreeting- const suggested = machineUserName()-- const greeting = suggested ? `${copy.line}\n\n${copy.nameSuggestion(suggested)}` : copy.line- $onboardingGreeting.set(greeting)-- return greeting-}-export const $chatLayoutPicked = atom(false)let previousLayout: {@@ -85,16 +67,31 @@ export function startChatOnboardingSolo(): void {}$chatOnboardingSolo.set(true)$chatLayoutPicked.set(false)- void loadMachineProfile()- applyLayoutPreset('chat-solo', group(['workspace'], { tabStrip: 'never' }))+ applyLayoutPreset(DEMO_LAYOUT_ID, DEMO_TREE)}+/** Leave the demo for the user's own layout at the normal window size. */export function endChatOnboardingSolo(): void {+ if ($chatOnboardingSolo.get()) {+ window.hermesDesktop?.chatOnboarding?.size('normal')+ }+$chatOnboardingSolo.set(false)- $onboardingGreeting.set('')restorePreviousLayout()}+/** Leave the demo on the layout just picked in it: drop the snapshot, release the hold, save the pick. */+export function keepChatOnboardingLayout(): void {+ previousLayout = null++ if ($chatOnboardingSolo.get()) {+ window.hermesDesktop?.chatOnboarding?.size('normal')+ }++ $chatOnboardingSolo.set(false)+ persistTree()+}+function restorePreviousLayout() {const previous = previousLayoutpreviousLayout = null@@ -139,6 +136,8 @@ function reconcileLayout(id: string, tree: LayoutNode): void {}export function assembleChatOnboarding(id: string, tree: LayoutNode, mode?: InterfaceMode): void {+ $chatOnboardingSolo.set(false)+if (mode && mode !== $interfaceMode.get()) {restorePreviousLayout()setInterfaceMode(mode)@@ -149,8 +148,6 @@ export function assembleChatOnboarding(id: string, tree: LayoutNode, mode?: Intewindow.hermesDesktop?.chatOnboarding?.size('normal')reconcileLayout(id, tree)-- $chatOnboardingSolo.set(false)}export function snapshotChatLayout(): () => void {@@ -170,6 +167,15 @@ export function snapshotChatLayout(): () => void {setInterfaceMode(snapshot.mode)}+ // A pick made in the demo ended the intro, so undoing it lands on the user's own layout.+ if (snapshot.solo) {+ previousLayout = snapshot.previous+ restorePreviousLayout()+ $chatLayoutPicked.set(snapshot.picked)++ return+ }+if (snapshot.tree) {$layoutTree.set(snapshot.tree)$paneStates.set(snapshot.panes)@@ -180,42 +186,32 @@ export function snapshotChatLayout(): () => void {previousLayout = snapshot.previous$chatLayoutPicked.set(snapshot.picked)-- if (snapshot.solo && !$chatOnboardingSolo.get()) {- $chatOnboardingSolo.set(true)- window.hermesDesktop?.chatOnboarding?.size('onboarding')- }- }-}--export function skipChatOnboarding(): void {- const preset = registry.getArea('layouts').find(contribution => contribution.id === 'basic')-- if (preset?.data) {- assembleChatOnboarding(preset.id, preset.data as LayoutNode)- } else {- $chatOnboardingSolo.set(false)}-- skipGuide()}+/** The setup chat is guided only while the intro runs; in `ended` or `off` it is a normal chat. The+ * thread ids outlive the intro so a later `start_chat` from that chat is still recognized. */export function useOnboardingChatActive(): boolean {const solo = useStore($chatOnboardingSolo)+ const intro = useStore($introView) === 'intro'const threadIds = useStore($chatOnboardingThreadIds)const runtimeId = useStore($activeSessionId)const storedId = useStore($selectedStoredSessionId)return (- solo || (runtimeId != null && threadIds.includes(runtimeId)) || (storedId != null && threadIds.includes(storedId))+ solo ||+ (intro &&+ ((runtimeId != null && threadIds.includes(runtimeId)) || (storedId != null && threadIds.includes(storedId)))))}/** Whether the chat view this renders in (primary or a tile) shows the setup- * chat. Solo covers the primary view before the guide's session ids are known. */+ * chat while the intro runs. Solo covers the primary view before the guide's+ * session ids are known; in `ended` or `off` the setup chat is a normal chat. */export function useSetupChatView(): boolean {const view = useSessionView()const solo = useStore($chatOnboardingSolo)+ const intro = useStore($introView) === 'intro'const runtimeId = useStore(view.$runtimeId)const storedId = useStore(view.$storedId)@@ -223,5 +219,5 @@ export function useSetupChatView(): boolean {[runtimeId, storedId].some(id => id != null && ids.includes(id)))- return (view.kind === 'primary' && solo) || inThread+ return (view.kind === 'primary' && solo) || (intro && inThread)}diff --git a/apps/desktop/src/components/onboarding-chat/gate.tsx b/apps/desktop/src/components/onboarding-chat/gate.tsxindex e7a77bb9c49..5660fd6b502 100644--- a/apps/desktop/src/components/onboarding-chat/gate.tsx+++ b/apps/desktop/src/components/onboarding-chat/gate.tsx@@ -2,12 +2,10 @@ import type { OnboardingStateResult } from '@hermes/shared'import { useStore } from '@nanostores/react'import { useEffect } from 'react'-import { endChatOnboardingSolo, takeGuideShape } from '@/components/onboarding-chat/assembly'import { isOnboardingEnabled } from '@/lib/onboarding-enabled'import { ackFreeTierNotice, type FreeTierRequester } from '@/store/free-tier'-import { $desktopOnboarding, clearFreeTierIntro } from '@/store/onboarding'+import { clearFreeTierIntro } from '@/store/onboarding'import {- $guideOpening,$onboardingGate,$setupProfileName,abandonGuide,@@ -16,8 +14,13 @@ import {markOnboardingStateRead,runGuideKickoff} from '@/store/onboarding-gate'+import { $introView } from '@/store/onboarding-intro'-import { GuideLoading } from './guide-loading'+import { failIntro, startIntro } from './intro'++// `starting` is never left waiting on a hung kickoff: past this it counts as a failed start. The kickoff+// notices on its next step and undoes what it did.+const INTRO_START_DEADLINE_MS = 45_000interface OnboardingChatGateProps {enabled: boolean@@ -25,9 +28,9 @@ interface OnboardingChatGateProps {requestGateway: FreeTierRequester}+/** Mounted in the main window only: secondary windows never run the intro. */export function OnboardingChatGate({ enabled, onKickoff, requestGateway }: OnboardingChatGateProps) {const gate = useStore($onboardingGate)- const opening = useStore($guideOpening)useEffect(() => {if (!enabled || !isOnboardingEnabled()) {@@ -38,10 +41,10 @@ export function OnboardingChatGate({ enabled, onKickoff, requestGateway }: Onboa.then(state => {$setupProfileName.set(state.profile ?? null)- beginOnboardingFlow(state, $desktopOnboarding.get().firstRunSkipped)+ beginOnboardingFlow(state)if ($onboardingGate.get().guideQueued) {- takeGuideShape()+ startIntro()}},error => console.warn('[onboarding] state could not be read', error)@@ -63,8 +66,8 @@ export function OnboardingChatGate({ enabled, onKickoff, requestGateway }: Onboa})}- return $onboardingGate.subscribe(state => {- if (state.phase === 'guided') {+ return $introView.subscribe(view => {+ if (view === 'intro') {ack()}})@@ -73,20 +76,32 @@ export function OnboardingChatGate({ enabled, onKickoff, requestGateway }: OnboauseEffect(() => {if (enabled && gate.guideQueued) {const recover = (result: Exclude<GuideKickoffResult, 'started'>) => {- endChatOnboardingSolo()+ failIntro()abandonGuide(result)}- void runGuideKickoff(onKickoff).then(- result => {- if (result !== 'started') {- recover(result)- }- },- () => recover('failed')- )+ let settled = false++ const settle = (result: GuideKickoffResult) => {+ if (settled) {+ return+ }++ settled = true+ window.clearTimeout(deadline)++ if (result !== 'started') {+ recover(result)+ }+ }++ const deadline = window.setTimeout(() => settle('failed'), INTRO_START_DEADLINE_MS)++ void runGuideKickoff(onKickoff).then(settle, () => settle('failed'))++ return () => window.clearTimeout(deadline)}}, [enabled, gate.guideQueued, onKickoff])- return opening ? <GuideLoading /> : null+ return null}diff --git a/apps/desktop/src/components/onboarding-chat/guide-loading.tsx b/apps/desktop/src/components/onboarding-chat/guide-loading.tsxdeleted file mode 100644index c88d74fc2c7..00000000000--- a/apps/desktop/src/components/onboarding-chat/guide-loading.tsx+++ /dev/null@@ -1,32 +0,0 @@-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'--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/components/onboarding-chat/intro-copy.css b/apps/desktop/src/components/onboarding-chat/intro-copy.cssnew file mode 100644index 00000000000..e5fc8df699e--- /dev/null+++ b/apps/desktop/src/components/onboarding-chat/intro-copy.css@@ -0,0 +1,66 @@+/* The demo layout's narrower reading column (the landed column read a tad too wide). */+:root[data-onboarding-demo] {+ --composer-width: 36rem;+}++/* Covers the empty setup chat above the composer until the first assistant row lands. */+[data-slot='intro-copy'] {+ position: absolute;+ inset: 0 0 var(--composer-measured-height);+ z-index: 20;+ pointer-events: none;+ background: var(--ui-chat-surface-background);+}++/* Same column as the thread content, so the risen copy sits where the first message lands. */+.intro-copy-text {+ position: absolute;+ top: 50%;+ left: 50%;+ display: grid;+ gap: 0.35rem;+ width: min(var(--composer-width), 100%);+ padding-inline: 1.5rem;+ color: var(--ui-text-primary);+ font-size: 1.125rem;+ font-weight: 500;+ line-height: 1.45;+ text-align: center;+ transform: translate(-50%, -50%);+ transition:+ top 530ms cubic-bezier(0.34, 1.45, 0.64, 1),+ transform 530ms cubic-bezier(0.34, 1.45, 0.64, 1),+ font-size 530ms ease,+ gap 530ms ease;+}++.intro-copy-text p {+ min-height: 1lh;+ margin: 0;+}++.intro-copy-second {+ color: var(--ui-text-secondary);+ transition: color 530ms ease;+}++[data-slot='intro-copy'][data-risen] .intro-copy-text {+ top: calc(var(--titlebar-height) - 0.5rem);+ gap: var(--paragraph-gap);+ font-size: var(--conversation-text-font-size);+ font-weight: 400;+ line-height: var(--conversation-line-height);+ text-align: left;+ transform: translate(-50%, 0);+}++[data-slot='intro-copy'][data-risen] .intro-copy-second {+ color: inherit;+}++@media (prefers-reduced-motion: reduce) {+ .intro-copy-text,+ .intro-copy-second {+ transition: none;+ }+}diff --git a/apps/desktop/src/components/onboarding-chat/intro-copy.tsx b/apps/desktop/src/components/onboarding-chat/intro-copy.tsxnew file mode 100644index 00000000000..de56774ac91--- /dev/null+++ b/apps/desktop/src/components/onboarding-chat/intro-copy.tsx@@ -0,0 +1,119 @@+import './guide-loading.css'+import './intro-copy.css'++import { useStore } from '@nanostores/react'+import { useEffect, useState } from 'react'++import { useSessionView } from '@/app/chat/session-view'+import { useMediaQuery } from '@/hooks/use-media-query'+import { chatMessageText } from '@/lib/chat-messages'+import { useStoreSelector } from '@/lib/use-session-slice'++import { $introCopy, $introTurnSent } from './intro'++// App-owned, English only. The backend's prelude writes the same words (INTRO in+// agent/initiate_setup_prompt.py; keep the two equal) as the setup chat's first assistant row, which+// replaces this copy once it lands.+const LINES = ["Hi, I'm Hermes.", "Let's set things up for you. Then we'll get something cool done."] as const++// The boot overlay (the `starting` screen) clears its text before it fades; typing starts under the fade.+const START_MS = 660+const LINE_1_MS = (LINES[0].length * 1000) / 26+const LINE_GAP_MS = 300+const LINE_2_MS = (LINES[1].length * 1000) / 48+// Typing never runs past 2.5 s: a throttled frame snaps the rest in.+const TYPED_MS = Math.min(LINE_1_MS + LINE_GAP_MS + LINE_2_MS, 2500)+const HOLD_MS = 250+const SPRING_MS = 530++function typedAt(elapsed: number): readonly [string, string] {+ if (elapsed >= TYPED_MS) {+ return LINES+ }++ const first = Math.floor((Math.min(elapsed, LINE_1_MS) / LINE_1_MS) * LINES[0].length)+ const second = Math.floor((Math.max(0, elapsed - LINE_1_MS - LINE_GAP_MS) / LINE_2_MS) * LINES[1].length)++ return [LINES[0].slice(0, first), LINES[1].slice(0, Math.min(second, LINES[1].length))]+}++/** Centred intro copy that springs up into the empty setup chat. Primary chat view only. */+export function IntroCopy() {+ const stage = useStore($introCopy)+ const view = useSessionView()+ const reducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)')+ const [elapsed, setElapsed] = useState(0)+ const [risen, setRisen] = useState(false)++ // The first visible assistant words land here; a turn that ended without any (an error) shows itself.+ const landed = useStoreSelector(view.$messages, messages =>+ messages.some(message => message.role === 'assistant' && !message.hidden && chatMessageText(message).trim())+ )++ const busy = useStore(view.$busy)+ const awaiting = useStore(view.$awaitingResponse)+ const turnSent = useStore($introTurnSent)+ const settledWithoutWords = turnSent && !busy && !awaiting++ useEffect(() => {+ if (stage !== 'playing') {+ return+ }++ if (reducedMotion) {+ setElapsed(TYPED_MS)+ setRisen(true)+ $introCopy.set('landed')++ return+ }++ const started = performance.now() + START_MS+ let frame = 0+ let timer = 0++ const tick = () => {+ const now = Math.max(0, performance.now() - started)+ setElapsed(now)++ if (now < TYPED_MS) {+ frame = requestAnimationFrame(tick)++ return+ }++ timer = window.setTimeout(() => {+ setRisen(true)+ timer = window.setTimeout(() => $introCopy.set('landed'), SPRING_MS)+ }, HOLD_MS)+ }++ frame = requestAnimationFrame(tick)++ return () => {+ cancelAnimationFrame(frame)+ window.clearTimeout(timer)+ }+ }, [reducedMotion, stage])++ useEffect(() => {+ if (stage === 'landed' && (landed || settledWithoutWords)) {+ $introCopy.set('hidden')+ }+ }, [landed, settledWithoutWords, stage])++ if (stage === 'hidden') {+ return null+ }++ const [first, second] = typedAt(elapsed)++ return (+ <div aria-label={LINES.join(' ')} data-risen={risen ? '' : undefined} data-slot="intro-copy" role="status">+ <div aria-hidden="true" className="intro-copy-text">+ <p>{first}</p>+ <p className="intro-copy-second">{second}</p>+ </div>+ </div>+ )+}diff --git a/apps/desktop/src/components/onboarding-chat/intro.ts b/apps/desktop/src/components/onboarding-chat/intro.tsnew file mode 100644index 00000000000..43fc9b9c441--- /dev/null+++ b/apps/desktop/src/components/onboarding-chat/intro.ts@@ -0,0 +1,176 @@+import { atom } from 'nanostores'++import { DEMO_LAYOUT_ID } from '@/app/contrib/layout-presets'+import { PANE_TOGGLE_REVEAL_EVENT } from '@/components/pane-shell'+import { $activePresetId } from '@/components/pane-shell/tree/store'+import { TIP_CATALOG } from '@/lib/tips/catalog'+import { LOCAL_SETUP_TIP_ID } from '@/lib/tips/local-cta'+import { $sidebarOpen, CHAT_SIDEBAR_PANE_ID } from '@/store/layout'+import { notify } from '@/store/notifications'+import { $onboardingGate, $setupProfileName, completeGuide, leaveGuide, skipGuide } from '@/store/onboarding-gate'+import { $introView } from '@/store/onboarding-intro'+import {+ $activeGatewayProfile,+ $newChatProfile,+ $newChatRoute,+ type AgentProfileRoute,+ normalizeProfileKey,+ selectProfile+} from '@/store/profile'+import { $selectedStoredSessionId } from '@/store/session'+import { storedSessionIdForRuntimeId } from '@/store/session-states'+import { retireTips } from '@/store/tips'+import { $toursEnabled } from '@/store/tours'++import { $chatOnboardingThreadIds, endChatOnboardingSolo, keepChatOnboardingLayout } from './assembly'+import { showHandoffTour } from './signpost'++/**+ * The intro copy over an empty setup chat: it types centred (`playing`), springs up and waits at+ * the top (`landed`) until the backend's first assistant row, which carries the same words,+ * takes its place.+ */+export type IntroCopyStage = 'hidden' | 'landed' | 'playing'++export const $introCopy = atom<IntroCopyStage>('hidden')++/** The hidden `/initiate-setup` turn has been handed to the backend (or failed to be). */+export const $introTurnSent = atom(false)++interface LaunchSource {+ newChatProfile: null | string+ newChatRoute: AgentProfileRoute | null+ profile: string+}++// Where new chats went before the intro moved them into the setup profile.+let launch: LaunchSource | null = null++/** The boot overlay holds while the kickoff checks inference and opens the setup chat; the window takes+ * the demo shape only once inference is known to be there. */+export function startIntro(): void {+ $introView.set('starting')+}++export function rememberLaunchSource(): void {+ launch = {+ newChatProfile: $newChatProfile.get(),+ newChatRoute: $newChatRoute.get(),+ profile: $activeGatewayProfile.get()+ }+}++/** The setup chat is open. A chat with no assistant words yet plays the intro copy. */+export function openIntro(blank: boolean): void {+ $introView.set('intro')+ $introCopy.set(blank ? 'playing' : 'hidden')+}++export function failIntro(): void {+ $introView.set('off')+ $introCopy.set('hidden')+ endChatOnboardingSolo()+}++// `keepLayout`: a layout pick ends the intro on the picked layout, not on the one from before the intro.+function endIntroView(keepLayout = false): boolean {+ if ($introView.get() !== 'intro') {+ return false+ }++ $introView.set('ended')+ $introCopy.set('hidden')++ if (keepLayout) {+ keepChatOnboardingLayout()+ } else {+ endChatOnboardingSolo()+ }++ // A leave action that picked a profile itself (the rail, a new chat elsewhere) keeps its pick. Otherwise+ // new chats go to the launch profile by name: with no intent they would follow the active gateway,+ // which is still the setup profile.+ if (launch && $newChatProfile.get() === $setupProfileName.get()) {+ $newChatProfile.set(launch.newChatProfile ?? normalizeProfileKey(launch.profile))+ $newChatRoute.set(launch.newChatRoute)+ }++ return true+}++/** Any leave action (sidebar, another chat, a profile, a Cmd-K command) ends the intro. */+export function leaveIntro(): void {+ if (endIntroView()) {+ leaveGuide()+ }+}++/** A layout pick (the setup card, `apply_layout`, the layout picker) ends the intro and keeps the pick. */+function leaveIntroOnLayout(): void {+ if (endIntroView(true)) {+ leaveGuide()+ }+}++export function skipIntro(): void {+ if (!endIntroView()) {+ return+ }++ notify({ kind: 'info', message: 'Switching you over to your default profile' })+ skipGuide()+ // Skip stops the rest of the first run: the tutorial tips and the local-model tip.+ retireTips([...TIP_CATALOG.map(tip => tip.id), LOCAL_SETUP_TIP_ID])+ selectProfile(launch?.profile ?? 'default')+}++/** A setup chat's `start_chat` started the task chat: the guided first run is complete. */+export function finishGuidedOnboarding(runtimeId: string): void {+ const threads = $chatOnboardingThreadIds.get()+ const storedId = storedSessionIdForRuntimeId(runtimeId)++ if (!threads.includes(runtimeId) && !(storedId && threads.includes(storedId))) {+ return+ }++ const { phase } = $onboardingGate.get()++ endIntroView()+ completeGuide()++ if ((phase === 'guided' || phase === 'left') && $toursEnabled.get()) {+ void showHandoffTour()+ }+}++function watchLeaveActions(): () => void {+ const setupProfile = $activeGatewayProfile.get()++ // Below the collapse breakpoint ⌘B and the titlebar toggle only send the reveal event.+ const onReveal = (event: Event) => {+ const detail = (event as CustomEvent<{ id?: string; mode?: string }>).detail++ if (detail?.id === CHAT_SIDEBAR_PANE_ID && detail.mode !== 'close') {+ leaveIntro()+ }+ }++ window.addEventListener(PANE_TOGGLE_REVEAL_EVENT, onReveal)++ const stops = [+ () => window.removeEventListener(PANE_TOGGLE_REVEAL_EVENT, onReveal),+ $sidebarOpen.listen(() => leaveIntro()),+ $activePresetId.listen(id => id !== DEMO_LAYOUT_ID && leaveIntroOnLayout()),+ $activeGatewayProfile.listen(profile => profile !== setupProfile && leaveIntro()),+ $selectedStoredSessionId.listen(id => (!id || !$chatOnboardingThreadIds.get().includes(id)) && leaveIntro())+ ]++ return () => stops.forEach(stop => stop())+}++let stopWatching: (() => void) | null = null++$introView.listen(view => {+ stopWatching?.()+ stopWatching = view === 'intro' ? watchLeaveActions() : null+})diff --git a/apps/desktop/src/components/onboarding-chat/setup-profile.ts b/apps/desktop/src/components/onboarding-chat/setup-profile.tsindex f8846986509..b5fae246aba 100644--- a/apps/desktop/src/components/onboarding-chat/setup-profile.ts+++ b/apps/desktop/src/components/onboarding-chat/setup-profile.ts@@ -12,8 +12,6 @@ import { readOnboardingCapabilities } from '@/store/onboarding-capabilities'import { FIRST_USE_GUIDANCE, PLAIN_SPEECH } from '@/store/onboarding-script'import { getSessionOwnerHint } from '@/store/session'-export const SETUP_CHAT_TITLE = 'Welcome to Hermes'-export type SetupHandoffPhase = 'done' | 'error' | 'opening' | 'pending'export type HandoffPlan = 'build' | 'machine-setup' | 'plugin'diff --git a/apps/desktop/src/components/onboarding-chat/skip.tsx b/apps/desktop/src/components/onboarding-chat/skip.tsxindex eef731a15f7..a56f5c3aae3 100644--- a/apps/desktop/src/components/onboarding-chat/skip.tsx+++ b/apps/desktop/src/components/onboarding-chat/skip.tsx@@ -1,18 +1,21 @@import { useStore } from '@nanostores/react'-import { $chatOnboardingSolo, skipChatOnboarding } from '@/components/onboarding-chat/assembly'+import { $introView } from '@/store/onboarding-intro'++import { skipIntro } from './intro'export function OnboardingSkip() {- const solo = useStore($chatOnboardingSolo)+ const intro = useStore($introView) === 'intro'- if (!solo) {+ if (!intro) {return null}return (<buttonclassName="ml-auto text-[11px] text-(--ui-text-quaternary) transition-colors hover:text-(--ui-text-secondary)"- onClick={skipChatOnboarding}+ onClick={skipIntro}+ title="Switching you over to your default profile"type="button">Skip setupdiff --git a/apps/desktop/src/components/pane-shell/tree/presets.ts b/apps/desktop/src/components/pane-shell/tree/presets.tsindex 10bcdc2ef49..5e6cd13b10e 100644--- a/apps/desktop/src/components/pane-shell/tree/presets.ts+++ b/apps/desktop/src/components/pane-shell/tree/presets.ts@@ -27,6 +27,8 @@ export const LAYOUTS_AREA = 'layouts'*/export interface LayoutPresetSpec extends Tiered {id: string+ /** `false` keeps a preset off every picker and out of `apply_layout`; only its owner applies it. */+ listed?: falseorder: numberresting?: readonly string[]title: string@@ -41,7 +43,14 @@ export function registerBundledPresets(bundled: readonly LayoutPresetSpec[]) {}return registry.registerMany(- bundled.map(({ id, order, title, tree }) => ({ id, area: LAYOUTS_AREA, title, order, data: tree }))+ bundled.map(({ id, listed, order, title, tree }) => ({+ id,+ area: LAYOUTS_AREA,+ title,+ order,+ data: tree,+ ...(listed === false && { enabled: false })+ })))}diff --git a/apps/desktop/src/components/pane-shell/tree/renderer/narrow-overlays.tsx b/apps/desktop/src/components/pane-shell/tree/renderer/narrow-overlays.tsxindex 666863749fc..df98f5e9c41 100644--- a/apps/desktop/src/components/pane-shell/tree/renderer/narrow-overlays.tsx+++ b/apps/desktop/src/components/pane-shell/tree/renderer/narrow-overlays.tsx@@ -9,13 +9,13 @@import { useStore } from '@nanostores/react'import { type MouseEventHandler, useCallback, useEffect, useMemo, useRef, useState } from 'react'-import { $chatOnboardingSolo } from '@/components/onboarding-chat/assembly'import { PaneTab, PaneTabLabel, PaneTabStrip } from '@/components/ui/pane-tab'import { ContribBoundary, ContribRender } from '@/contrib/react/boundary'import { useContributions } from '@/contrib/react/use-contributions'import type { Contribution } from '@/contrib/types'import { ESCAPE_PRIORITY, isTopEscapeLayer, pushEscapeLayer } from '@/lib/escape-layers'import { cn } from '@/lib/utils'+import { $chatOnboardingSolo } from '@/store/onboarding-intro'import { $paneStates } from '@/store/panes'import { PANE_TOGGLE_REVEAL_EVENT } from '../..'diff --git a/apps/desktop/src/components/tips/use-tip-rotation.ts b/apps/desktop/src/components/tips/use-tip-rotation.tsindex 2e9482aff9c..3125432e59c 100644--- a/apps/desktop/src/components/tips/use-tip-rotation.ts+++ b/apps/desktop/src/components/tips/use-tip-rotation.ts@@ -29,6 +29,7 @@ import { resolveTipAnchor } from '@/lib/tips/anchor'import { TIP_CATALOG } from '@/lib/tips/catalog'import { nextTip } from '@/lib/tips/rotation'import { $localModelsEnabled } from '@/store/local-models-flag'+import { onboardingSurfaceActive } from '@/store/onboarding-presence'import { $awaitingResponse, $busy } from '@/store/session'import { $activeTip, $lastTipId, $nextTipAt, $retiredTips, $tipsEnabled, $tipShownAt, showTip } from '@/store/tips'import { checkTutorialLifetime } from '@/store/tutorial-lifetime'@@ -56,7 +57,8 @@ function appIsQuiet(lastTypedAt: number): boolean {return false}- if ($busy.get() || $awaitingResponse.get()) {+ // The first-run intro is never a quiet moment.+ if ($busy.get() || $awaitingResponse.get() || onboardingSurfaceActive()) {return false}diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex bfb432f3979..8086e55e056 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -2768,10 +2768,6 @@ export const ar = defineLocale({noReturn: 'لم تعد الواجهة الخلفية إلى الاتصال. قد لا يكون التحديث قد اكتمل — تحقق من مضيف الواجهة الخلفية.'}},- guidedGreeting: {- line: 'أهلا، تفضل بالدخول. أنا Hermes. امنحني دقيقتين لأرتب المكان حولك، ثم نبدأ بشيء تريد إنجازه فعلا.\n\nبداية، بماذا أناديك؟',- nameSuggestion: (name: string) => `(يمكنني أن أناديك ${name} إن كنت تفضل ذلك.)`- },install: {stageStates: {pending: 'قيد الانتظار',diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.tsindex 779eb1e68f0..c6532709541 100644--- a/apps/desktop/src/i18n/de.ts+++ b/apps/desktop/src/i18n/de.ts@@ -4744,10 +4744,6 @@ export const deOverrides = {stayText:'Wechseln Sie ins Einrichtungsprofil und öffnen Sie „Willkommen bei Hermes“, wenn Sie Hilfe brauchen. Es bleibt dort.'},- guidedGreeting: {- line: 'Hallo und willkommen. Ich bin Hermes. Geben Sie mir zwei Minuten, um alles für Sie einzurichten, dann setzen wir mich auf etwas an, das Sie wirklich erledigt haben möchten.\\n\\nAber zuerst: Wie soll ich Sie nennen?',- nameSuggestion: name => `(Ich kann Sie auch einfach ${name} nennen, wenn Ihnen das lieber ist.)`- },install: {stageStates: {pending: 'Ausstehend',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex ba1006f350d..dce02b02749 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -1436,6 +1436,12 @@ export const en: Translations = {alwaysExternalLinksTitle: 'Always open links in external browser',alwaysExternalLinksDesc:'Open every link you click in your system browser instead of the in-app browser. "Open in in-app browser" in the right-click menu still works.',+ developerTitle: 'Developer',+ resetOnboardingTitle: 'Reset onboarding',+ resetOnboardingDesc:+ 'Delete the setup chats, rebuild the setup profile and run the first-run setup again. Your own profiles, chats and plugins stay.',+ resetOnboardingAction: 'Reset',+ resetOnboardingFailed: 'Could not reset onboarding',attachmentSizeTitle: 'Max preview / image load size',attachmentSizeDesc:'How big a local file Desktop will load for previews and image attach, in MB. Default is 16. Remote non-image attach uses a separate 256 MB cap. Setting this very high loads the whole file into memory and can freeze or crash the app.',@@ -4363,10 +4369,6 @@ export const en: Translations = {messaging: { title: 'Messaging', text: 'Reach Hermes from Telegram, Slack, Discord and more.' },rightPane: { title: 'The working pane', text: 'Opens files, terminal, review and the in-app browser on the right.' }},- guidedGreeting: {- line: "Hey, come on in. I'm Hermes. Give me two minutes to set the place up around you, then we'll put me to work on something you actually want done.\n\nFirst though, what should I call you?",- nameSuggestion: (name: string) => `(I can also just call you ${name}, if you prefer.)`- },install: {stageStates: {pending: 'Pending',diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.tsindex a837695e59f..231b30a539d 100644--- a/apps/desktop/src/i18n/es.ts+++ b/apps/desktop/src/i18n/es.ts@@ -4737,10 +4737,6 @@ export const esOverrides = {stayTitle: 'Hermes está a un clic',stayText: 'Cambia al perfil de configuración y abre Bienvenida a Hermes siempre que necesites ayuda. Se queda ahí.'},- guidedGreeting: {- line: 'Hola, pasa. Soy Hermes. Dame dos minutos para prepararlo todo a tu medida y luego me pondremos a trabajar en algo que de verdad quieras hacer.\n\nPero antes, ¿cómo quieres que te llame?',- nameSuggestion: (name: string) => `(También puedo llamarte simplemente ${name}, si lo prefieres.)`- },install: {stageStates: {pending: 'Pendiente',diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.tsindex b8e6ae7ba65..ddfbd1102d9 100644--- a/apps/desktop/src/i18n/fr.ts+++ b/apps/desktop/src/i18n/fr.ts@@ -4759,10 +4759,6 @@ export const frOverrides = {stayText:'Passez au profil de configuration et ouvrez Bienvenue dans Hermes lorsque vous avez besoin d’aide. La conversation y reste disponible.'},- guidedGreeting: {- line: "Salut, entrez ! Je suis Hermes. Donnez-moi deux minutes pour préparer les lieux à votre façon, puis nous nous attaquerons à quelque chose que vous voulez vraiment accomplir.\n\nMais d'abord, comment dois-je vous appeler ?",- nameSuggestion: name => `(Je peux aussi simplement vous appeler ${name}, si vous préférez.)`- },install: {stageStates: {pending: 'En attente',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 5c95884631c..594985275dd 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -3176,10 +3176,6 @@ export const ja = defineLocale({checkingShort: '確認中…'},- guidedGreeting: {- line: 'やあ、どうぞ。Hermes です。二分だけください、あなたに合わせて整えます。それから、本当にやりたいことに取りかかりましょう。\n\nまずは、何とお呼びすればいいですか。',- nameSuggestion: (name: string) => `(よければ、${name} さんとお呼びします。)`- },install: {stageStates: {pending: '待機中',diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex d06c860fe4e..1804cc0bcb0 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -3413,10 +3413,6 @@ export const ru = defineLocale({bundleOutOfSyncAction: 'Скачать установщик',checkingShort: 'Проверка…'},- guidedGreeting: {- line: 'Заходите. Я Hermes. Дайте мне пару минут — обустрою тут всё под вас, а потом займёмся тем, что вам правда нужно.\n\nДля начала: как к вам обращаться?',- nameSuggestion: (name: string) => `(Могу звать вас просто ${name}, если так удобнее.)`- },install: {stageStates: {pending: 'Ожидает',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 5ab4421cdc1..6a441001184 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -1205,6 +1205,11 @@ export interface Translations {disableF12Desc: stringalwaysExternalLinksTitle: stringalwaysExternalLinksDesc: string+ developerTitle: string+ resetOnboardingTitle: string+ resetOnboardingDesc: string+ resetOnboardingAction: string+ resetOnboardingFailed: stringattachmentSizeTitle: stringattachmentSizeDesc: stringattachmentSizeUnit: string@@ -3655,10 +3660,6 @@ export interface Translations {messaging: { title: string; text: string }rightPane: { title: string; text: string }}- guidedGreeting: {- line: string- nameSuggestion: (name: string) => string- }install: {stageStates: Record<string, string>oneTimeTitle: stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex c19bb957070..99e7319cde1 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -3373,10 +3373,6 @@ export const zhHant = defineLocale({checkingShort: '檢查中…'},- guidedGreeting: {- line: '來了,進來吧。我是 Hermes。給我兩分鐘,把這裡按你的習慣整理一下,然後我們找件你真正想做的事來做。\n\n先說,我該怎麼稱呼你?',- nameSuggestion: (name: string) => `(如果你願意,我也可以直接叫你 ${name}。)`- },install: {stageStates: {pending: '等待中',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 59a78bed1e8..602252a0dbf 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -4095,10 +4095,6 @@ export const zh = defineLocale({versionDetailsUncommittedChanges: '未提交的变更'},- guidedGreeting: {- line: '来了,进来吧。我是 Hermes。给我两分钟,把这里按你的习惯收拾一下,然后我们找件你真正想做的事来做。\n\n先说,我该怎么称呼你?',- nameSuggestion: (name: string) => `(如果你愿意,我也可以直接叫你 ${name}。)`- },install: {stageStates: {pending: '等待中',diff --git a/apps/desktop/src/lib/layout-persistence.ts b/apps/desktop/src/lib/layout-persistence.tsindex 6e5a2a5415e..2c94b4b18fb 100644--- a/apps/desktop/src/lib/layout-persistence.ts+++ b/apps/desktop/src/lib/layout-persistence.ts@@ -67,6 +67,7 @@ export function createLayoutPersistence(initialMode: InterfaceMode, persistent:const snapshots = new Set<string>()let mode = initialModelet restoring = false+ let held = falseconst legacy = persistent ? migrateLayoutScopes(initialMode) : new Map<string, string>()@@ -76,7 +77,7 @@ export function createLayoutPersistence(initialMode: InterfaceMode, persistent:if (!restoring) {snapshots.add(keyFor(key))- if (persistent) {+ if (persistent && !held) {// Explicit empties keep migration retries from reviving cleared state.writeKey(keyFor(key), mode === 'simple' ? (raw ?? 'null') : raw)}@@ -140,6 +141,11 @@ export function createLayoutPersistence(initialMode: InterfaceMode, persistent:get restoring() {return restoring},+ /** While held, layout changes stay in memory: a borrowed layout (the first-run demo) is never+ * written over the user's own, and a relaunch opens on the user's layout. */+ hold(next: boolean) {+ held = next+ },has(key: string) {return snapshots.has(keyFor(key))},diff --git a/apps/desktop/src/store/onboarding-gate.ts b/apps/desktop/src/store/onboarding-gate.tsindex 7c37540c640..da1a44ba3b6 100644--- a/apps/desktop/src/store/onboarding-gate.ts+++ b/apps/desktop/src/store/onboarding-gate.ts@@ -5,8 +5,11 @@ import { isOnboardingEnabled } from '@/lib/onboarding-enabled'import { $gateway } from './gateway'import { DEFAULT_ANSWERS, setOnboardingAnswers } from './onboarding-answers'+import { resetTips } from './tips'-export const ONBOARDING_PHASES = ['idle', 'pending', 'guided', 'skipped', 'handoff', 'done'] as const+// `left`: the user walked out of the intro (sidebar, another chat, a layout pick) without skipping;+// the setup chat is a normal chat from then on and can still finish the guide.+export const ONBOARDING_PHASES = ['idle', 'pending', 'guided', 'left', 'skipped', 'handoff', 'done'] as constexport type OnboardingPhase = (typeof ONBOARDING_PHASES)[number]@@ -23,7 +26,8 @@ type GuideKickoff =export const $onboardingGate = atom<OnboardingGateState>({ phase: 'idle', guideQueued: false, guideKickoff: 'idle' })-const $onboardingStateRead = atom(false)+/** `onboarding.state` has answered (or failed) in this window. */+export const $onboardingStateRead = atom(false)/** The setup profile's name, from `onboarding.state` or from the kickoff that creates it; `null` when none is known. */export const $setupProfileName = atom<null | string>(null)@@ -86,14 +90,8 @@ export function afterOnboardingStateRead(run: () => void): void {})}-export function beginOnboardingFlow(state: OnboardingStateResult, firstRunSkipped: boolean): void {- if (- !isOnboardingEnabled() ||- !state.eligible ||- state.intro !== 'unseen' ||- firstRunSkipped ||- $onboardingGate.get().phase !== 'idle'- ) {+export function beginOnboardingFlow(state: OnboardingStateResult): void {+ if (!isOnboardingEnabled() || !state.eligible || state.intro !== 'unseen' || $onboardingGate.get().phase !== 'idle') {return}@@ -157,6 +155,22 @@ export function completeOnboardingFlow(): void {}}+/** A setup `start_chat` started the task chat: the guide is complete (the backend recorded it). */+export function completeGuide(): void {+ const { phase } = $onboardingGate.get()++ if (isOnboardingEnabled() && (phase === 'guided' || phase === 'left' || phase === 'skipped')) {+ setPhase('done')+ }+}++export function leaveGuide(): void {+ if (isOnboardingEnabled() && $onboardingGate.get().phase === 'guided') {+ setPhase('left')+ reportOnboarding('onboarding.mark_seen')+ }+}+export function skipGuide(): void {const { phase } = $onboardingGate.get()@@ -178,23 +192,14 @@ export function abandonGuide(result: Exclude<GuideKickoffResult, 'started'>): vo}}-export async function devResetOnboardingFlow(): Promise<void> {- if (!import.meta.env.DEV) {- return- }-- await $gateway.get()?.request('onboarding.reset_setup_profile', {})- setGuideKickoff({ status: 'idle' })- setPhase('idle')+/** Settings → Advanced → Developer: rebuild the setup profile and clear its marker, so the next+ * launch runs the first run from zero. The primary profile is left as it is. The caller reloads.+ * `request` is the ambient gateway requester (reconnects a stale socket); the params stay bare. */+export async function resetOnboarding(+ request: (method: string, params: Record<string, unknown>) => Promise<unknown>+): Promise<void> {+ await request('onboarding.reset_setup_profile', {})setOnboardingAnswers({ ...DEFAULT_ANSWERS, connectors: [], plugins: [], pluginOutcomes: {} })-}--declare global {- interface Window {- __onboarding?: { reset: typeof devResetOnboardingFlow }- }-}--if (import.meta.env.DEV) {- window.__onboarding = { reset: devResetOnboardingFlow }+ // Skip retired the tutorial tips; from zero means they come back.+ resetTips()}diff --git a/apps/desktop/src/store/onboarding-intro.ts b/apps/desktop/src/store/onboarding-intro.tsnew file mode 100644index 00000000000..508c15e1473--- /dev/null+++ b/apps/desktop/src/store/onboarding-intro.ts@@ -0,0 +1,20 @@+import { atom } from 'nanostores'++import { setOnboardingSurfaceActive } from './onboarding-presence'++/**+ * The first-run intro as this window shows it, in memory only: whether it runs at all is the+ * backend's `onboarding.state`. `starting` holds the boot overlay while the setup chat opens,+ * `intro` is the setup chat in the demo layout, `ended` means the user left it (or finished),+ * and `off` means it never ran or failed to start. Only the main window moves out of `off`.+ */+export type IntroView = 'off' | 'starting' | 'intro' | 'ended'++export const $introView = atom<IntroView>('off')++/** The demo layout is on screen: the chat alone, narrower, minimal composer, no status bar. Kept here,+ * free of layout imports, so the shell can read it; onboarding-chat/assembly.ts owns the switch. */+export const $chatOnboardingSolo = atom(false)++// While the intro runs, the provider picker, the free-tier ready screen and the tips wait for it.+$introView.subscribe(view => setOnboardingSurfaceActive('intro', view === 'starting' || view === 'intro'))diff --git a/apps/desktop/src/store/onboarding-presence.ts b/apps/desktop/src/store/onboarding-presence.tsindex c7718613b53..41163986ca9 100644--- a/apps/desktop/src/store/onboarding-presence.ts+++ b/apps/desktop/src/store/onboarding-presence.ts@@ -1,6 +1,6 @@import { atom } from 'nanostores'-export type OnboardingSurface = 'solo-chat'+export type OnboardingSurface = 'intro'const EMPTY: ReadonlySet<OnboardingSurface> = new Set()diff --git a/apps/desktop/src/store/tips.ts b/apps/desktop/src/store/tips.tsindex da5aac8eb30..4f98daf8b2f 100644--- a/apps/desktop/src/store/tips.ts+++ b/apps/desktop/src/store/tips.ts@@ -168,6 +168,22 @@ export function dismissTip(): void {$activeTip.set(null)}+/** Retire tips without showing them (Skip on the first-run intro); Settings → Reset brings them back. */+export function retireTips(ids: readonly string[]): void {+ const retired = $retiredTips.get()+ const fresh = ids.filter(id => !retired.includes(id))++ if (fresh.length > 0) {+ $retiredTips.set([...retired, ...fresh])+ }++ const activeId = $activeTip.get()?.tipId++ if (activeId && ids.includes(activeId)) {+ $activeTip.set(null)+ }+}+/** Hard close (the ✕): retire the identified tip behind the bubble for good. */export function retireActiveTip(): void {const tipId = $activeTip.get()?.tipIddiff --git a/apps/desktop/src/store/windows.ts b/apps/desktop/src/store/windows.tsindex 8c73b456245..b46d5b4247a 100644--- a/apps/desktop/src/store/windows.ts+++ b/apps/desktop/src/store/windows.ts@@ -125,6 +125,10 @@ export function isPeerInstanceWindow(search = typeof window === 'undefined' ? ''}}+// The one window that runs the first-run intro and holds the boot overlay for it: not an auxiliary+// renderer, not a full peer (⌘⇧N) and not a subagent watcher.+export const isMainWindow = (): boolean => !isAuxiliaryWindow() && !isPeerInstanceWindow() && !isWatchWindow()+// Set by Electron only for an explicit "Open profile in new window". An// ordinary ⌘⇧N peer also carries profile/connectionId (its boot seed) but not// this marker, so a later device/profile selection stays the New-sessiondiff --git a/apps/shared/src/skill-scaffold.ts b/apps/shared/src/skill-scaffold.tsindex fffae405b2a..79c77720543 100644--- a/apps/shared/src/skill-scaffold.ts+++ b/apps/shared/src/skill-scaffold.ts@@ -13,6 +13,8 @@* The markers below mirror `agent/skill_commands.py` byte for byte.*/+// agent/initiate_setup_prompt.py HEADER: the /initiate-setup built-in's own header.+const INITIATE_SETUP_HEADER = '[/initiate-setup]'const INVOCATION_PREFIX = '[IMPORTANT: The user has invoked the 'const SINGLE_MARKER = 'The full skill content is loaded below.]'const SINGLE_INSTRUCTION = 'The user has provided the following instruction alongside the skill invocation: '@@ -44,6 +46,10 @@ function between(text: string, marker: string, end: string, fromEnd = false): st* when `text` is ordinary user prose that should render as written.*/export function skillInvocationText(text: string): null | string {+ if (text.startsWith(INITIATE_SETUP_HEADER)) {+ return '/initiate-setup'+ }+if (!text.startsWith(INVOCATION_PREFIX)) {return null}