Skip to content

The agent that grows with you

refactor(desktop): delete the guided setup chat renderer

alt-glitch3d60b35a76ef
diff --git a/apps/desktop/src/app/chat/chat-surface-state.ts b/apps/desktop/src/app/chat/chat-surface-state.ts
index 328c32f6265..aa061a9996d 100644
--- a/apps/desktop/src/app/chat/chat-surface-state.ts
+++ b/apps/desktop/src/app/chat/chat-surface-state.ts
@@ -6,7 +6,6 @@ import type { DragKind } from './hooks/use-file-drop-zone'
import { composerStaysMounted } from './thread-loading'
interface ShowChatBarOptions {
- guideOpening: boolean
loadingSession: boolean
resumeExhausted: boolean
routedSessionId: null | string
@@ -21,7 +20,6 @@ interface ShowChatBarOptions {
// (periodic list/status refresh, hydrate through an empty frame) must not
// unmount it again — see composerStaysMounted (#117375).
export function useShowChatBar({
- guideOpening,
loadingSession,
resumeExhausted,
routedSessionId,
@@ -29,7 +27,7 @@ export function useShowChatBar({
}: ShowChatBarOptions): boolean {
const settledRoutedSessionRef = useRef<null | string>(null)
- if (!guideOpening && !loadingSession && routedSessionView) {
+ if (!loadingSession && routedSessionView) {
settledRoutedSessionRef.current = routedSessionId
} else if (!routedSessionView) {
settledRoutedSessionRef.current = null
diff --git a/apps/desktop/src/app/chat/chat-swap-overlay.tsx b/apps/desktop/src/app/chat/chat-swap-overlay.tsx
index 3bba0606abd..4e8068f2a45 100644
--- a/apps/desktop/src/app/chat/chat-swap-overlay.tsx
+++ b/apps/desktop/src/app/chat/chat-swap-overlay.tsx
@@ -1,6 +1,5 @@
import { useEffect, useState } from 'react'
-import { useOnboardingChatActive } from '@/components/onboarding-chat/assembly'
import { GlyphSpinner } from '@/components/ui/glyph-spinner'
import { useI18n } from '@/i18n'
import { cn } from '@/lib/utils'
@@ -10,7 +9,6 @@ import { cn } from '@/lib/utils'
// the label doesn't blank. Purely visual — pointer-events-none.
export function ChatSwapOverlay({ profile }: { profile: string | null }) {
const { t } = useI18n()
- const onboarding = useOnboardingChatActive()
const [label, setLabel] = useState<null | string>(profile)
useEffect(() => {
@@ -19,16 +17,6 @@ export function ChatSwapOverlay({ profile }: { profile: string | null }) {
}
}, [profile])
- // The first run swaps profiles twice — into the setup profile, then into the
- // task profile — and neither is a thing the user asked for or has a name for.
- // "Waking up <setup profile>…" over a greeting that is already on screen reads
- // as a stall in the one moment that has to feel instant. The flow narrates
- // its own handoff (the handoff card) and the greeting is banked, so there
- // is nothing here to cover.
- if (onboarding) {
- return null
- }
-
return (
<div
aria-hidden
diff --git a/apps/desktop/src/app/chat/composer/controls.tsx b/apps/desktop/src/app/chat/composer/controls.tsx
index dc278982791..8cecbee42fc 100644
--- a/apps/desktop/src/app/chat/composer/controls.tsx
+++ b/apps/desktop/src/app/chat/composer/controls.tsx
@@ -45,7 +45,6 @@ export function ComposerControls({
disabled,
foldVoice = false,
hasComposerPayload,
- hideModelPill = false,
minimal = false,
state,
voiceStatus,
@@ -62,7 +61,6 @@ export function ComposerControls({
disabled: boolean
foldVoice?: boolean
hasComposerPayload: boolean
- hideModelPill?: boolean
minimal?: boolean
state: ChatBarState
voiceStatus: VoiceStatus
@@ -117,12 +115,8 @@ export function ComposerControls({
<div className="flex min-w-0 shrink items-center gap-(--composer-control-gap)">
{minimal ? null : (
<>
- {hideModelPill ? null : (
- <>
- <ModelPill compact={compactModelPill} disabled={disabled} model={state.model} />
- {compactModelPill ? null : <ReasoningPill disabled={disabled} model={state.model} />}
- </>
- )}
+ <ModelPill compact={compactModelPill} disabled={disabled} model={state.model} />
+ {compactModelPill ? null : <ReasoningPill disabled={disabled} model={state.model} />}
{voiceControls}
</>
)}
diff --git a/apps/desktop/src/app/chat/composer/index.tsx b/apps/desktop/src/app/chat/composer/index.tsx
index aa77990f202..1127f41f64d 100644
--- a/apps/desktop/src/app/chat/composer/index.tsx
+++ b/apps/desktop/src/app/chat/composer/index.tsx
@@ -14,8 +14,6 @@ import {
import { useTourMarker } from '@/app/chat/tour-marker'
import { useHudComposerDrag } from '@/app/hud/composer-drag'
import { composerFloatingStrip, composerInputBacking } from '@/components/chat/composer-dock'
-import { useSetupChatView } from '@/components/onboarding-chat/assembly'
-import { OnboardingSkip } from '@/components/onboarding-chat/skip'
import { Button } from '@/components/ui/button'
import { Slot as ContribSlot } from '@/contrib/react/slot'
import { useI18n } from '@/i18n'
@@ -32,7 +30,6 @@ 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'
@@ -183,16 +180,9 @@ export function ChatBar({
// queue uses the stored-session fallback key (prompts can queue pre-resume).
const statusSessionId = sessionId ?? null
- // 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. 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)
- const codingRowShown = !guidedChat && showsAdvancedChrome
+ // The git row (branch / worktree / PR / review) is a coding instrument;
+ // Simple mode hides it everywhere.
+ const codingRowShown = useStore($showsAdvancedChrome)
const composerTourMarker = useTourMarker('composer')
@@ -1123,8 +1113,7 @@ export function ChatBar({
disabled={disabled}
foldVoice={foldVoice}
hasComposerPayload={hasComposerPayload}
- hideModelPill={guidedChat}
- minimal={minimal || chatOnboardingSolo}
+ minimal={minimal}
onDictate={dictate}
onQueue={queueDraft}
onToggleAutoSpeak={handleToggleAutoSpeak}
@@ -1301,7 +1290,6 @@ export function ChatBar({
<div className={cn(composerFloatingStrip, 'px-[5px] pb-1.5 empty:hidden')}>
<ActionBadges sessionId={statusSessionId} />
<SuggestionPills sessionId={statusSessionId} />
- <OnboardingSkip />
</div>
{/* Session-scoped status stack (todos, subagents, background tasks,
queue). An in-flow dock child: the dock is bottom-anchored, so it
@@ -1434,7 +1422,7 @@ export function ChatBar({
/>
)}
<div className="relative w-full rounded-[inherit]">
- {!hudMode && !guidedChat && (
+ {!hudMode && (
<StatusDrawerToggle
collapsed={statusDrawerCollapsed}
controls={`${statusDrawerId} ${codingDrawerId}`}
diff --git a/apps/desktop/src/app/chat/index.tsx b/apps/desktop/src/app/chat/index.tsx
index 5c019a23c97..730ce13c3cd 100644
--- a/apps/desktop/src/app/chat/index.tsx
+++ b/apps/desktop/src/app/chat/index.tsx
@@ -11,9 +11,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 { useSetupChatView } from '@/components/onboarding-chat/assembly'
-import { $introHoldsThread } from '@/components/onboarding-chat/intro'
-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'
@@ -29,7 +26,6 @@ import { migrateSessionDraft } from '@/store/composer'
import { migrateQueuedPrompts, parkQueuedPrompts } from '@/store/composer-queue'
import { $introSplash } from '@/store/intro-splash'
import { $pinnedSessionIds } from '@/store/layout'
-import { $guideOpening, $onboardingGate } from '@/store/onboarding-gate'
import { $petActive } from '@/store/pet'
import { $petOverlayActive } from '@/store/pet-overlay'
import { $activeGatewayProfile, $gatewaySwapTarget, $hydrationSyncProfile, $profiles } from '@/store/profile'
@@ -52,7 +48,7 @@ import {
import { $focusedStoredSessionId } from '@/store/session-focus'
import { $sessionStates, sessionTileDelegate } from '@/store/session-states'
import { $transcriptTailBySessionId, transcriptTailState } from '@/store/transcript-tail'
-import { isAuxiliaryWindow, isMainWindow } from '@/store/windows'
+import { isAuxiliaryWindow } from '@/store/windows'
import { primaryRouteSelectedSessionId, routeSessionId } from '../routes'
import { titlebarHeaderBaseClass, titlebarHeaderShadowClass, titlebarHeaderTitleClass } from '../shell/titlebar'
@@ -521,9 +517,6 @@ const ChatViewContent = memo(function ChatViewContent({
const composerScope = useComposerScope()
const composerSurfaceId = useComposerSurfaceId()
const isPrimary = view.kind === 'primary'
- const guideOpening = useStore($guideOpening) && isPrimary
- const introHoldsThread = useStore($introHoldsThread) && isPrimary && isMainWindow()
- const guideStarted = useStoreSelector($onboardingGate, gate => gate.guideKickoff === 'started')
const activeSessionId = useStore(view.$runtimeId)
const transcriptStoredSessionId = useStoreSelector($sessionStates, states =>
@@ -531,7 +524,6 @@ const ChatViewContent = memo(function ChatViewContent({
)
const storedId = useStore(view.$storedId)
- const setupChat = useSetupChatView()
// Multi-pane dimming: only the focused surface paints at full strength, so
// two sessions side by side read as "this one, and that one over there".
// A selector, not a plain useStore — the focused id changes on click, and a
@@ -681,7 +673,6 @@ const ChatViewContent = memo(function ChatViewContent({
const threadLoading = threadLoadingState(loadingSession, busy, awaitingResponse, lastVisibleIsUser)
const showChatBar = useShowChatBar({
- guideOpening,
loadingSession,
resumeExhausted,
routedSessionId,
@@ -755,9 +746,7 @@ const ChatViewContent = memo(function ChatViewContent({
data-chat-unfocused={surfaceFocused || surfaceHovered ? undefined : ''}
data-composer-surface-id={composerSurfaceId}
data-composer-target={composerScope.target}
- data-guide-arrived={isPrimary && guideStarted ? '' : undefined}
data-session-anchor={sessionAnchor}
- data-setup-chat={setupChat ? '' : undefined}
>
<Backdrop />
{/* Tiles get their chrome from the layout zone (chip strip); the modal
@@ -787,27 +776,23 @@ const ChatViewContent = memo(function ChatViewContent({
>
<div
className="relative min-h-0 max-w-full flex-1 overflow-hidden bg-(--ui-chat-surface-background) contain-[layout_paint]"
- data-intro-holding={introHoldsThread ? '' : undefined}
data-slot="composer-bounds"
{...dropHandlers}
>
- {!guideOpening && (
- <Thread
- clampToComposer={showChatBar}
- cwd={currentCwd}
- gateway={gateway}
- intro={showIntro ? { personality: introPersonality, seed: introSeed } : undefined}
- loading={threadLoading}
- onBranchInNewChat={onBranchInNewChat}
- onCancel={haltRun}
- onDismissError={onDismissError}
- onRestoreToMessage={onRestoreToMessage}
- scrollProfile={modelOptionsProfile || activeGatewayProfile}
- sessionId={activeSessionId}
- sessionKey={threadKey}
- />
- )}
- {isPrimary && isMainWindow() && <IntroCopy />}
+ <Thread
+ clampToComposer={showChatBar}
+ cwd={currentCwd}
+ gateway={gateway}
+ intro={showIntro ? { personality: introPersonality, seed: introSeed } : undefined}
+ loading={threadLoading}
+ onBranchInNewChat={onBranchInNewChat}
+ onCancel={haltRun}
+ onDismissError={onDismissError}
+ onRestoreToMessage={onRestoreToMessage}
+ scrollProfile={modelOptionsProfile || activeGatewayProfile}
+ sessionId={activeSessionId}
+ sessionKey={threadKey}
+ />
{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.tsx
index 235394bb5e7..3ca47539459 100644
--- a/apps/desktop/src/app/command-palette/index.tsx
+++ b/apps/desktop/src/app/command-palette/index.tsx
@@ -14,7 +14,6 @@ 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'
@@ -1587,8 +1586,6 @@ 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.ts
index 843a87242b7..0ed3dafa14a 100644
--- a/apps/desktop/src/app/contrib/layout-presets.ts
+++ b/apps/desktop/src/app/contrib/layout-presets.ts
@@ -81,12 +81,6 @@ 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',
[
@@ -120,7 +114,6 @@ export function registerLayoutPresets() {
resting: TERMINAL_RESTING,
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 }
+ { id: 'quad', title: 'Quad', order: 30, tree: QUAD_TREE, tier: 'advanced' }
])
}
diff --git a/apps/desktop/src/app/contrib/onboarding-kickoff-machine.ts b/apps/desktop/src/app/contrib/onboarding-kickoff-machine.ts
deleted file mode 100644
index 95e146f51d1..00000000000
--- a/apps/desktop/src/app/contrib/onboarding-kickoff-machine.ts
+++ /dev/null
@@ -1,173 +0,0 @@
-import { GatewayReauthRequiredError, JsonRpcGatewayError } from '@hermes/shared'
-
-import { isTimeoutError } from '@/lib/with-timeout'
-import { $gatewaySwitching } from '@/store/gateway-switch'
-import { $gatewayState } from '@/store/session'
-
-/**
- * The welcome chat's start, as explicit states. While the kickoff is in a state it knows how to wait on
- * (the backend process is alive, the gateway is open or reconnecting, a call is in flight) it waits with no
- * wall-clock deadline: a cold first boot answers late, but it answers (51 s to listen on a Windows ARM64
- * first boot, then a busy backend behind the first calls). It fails only on what waiting cannot fix: an
- * RPC error response, the backend process exiting, a result it does not expect, or `stop` (the person chose
- * to go on without setup once the wait outlasted the boot budget).
- */
-type KickoffState = 'waiting-backend' | 'preparing' | 'opening' | 'started' | 'off' | 'failed'
-
-/** json-rpc-channel arms a call's timer only for a positive timeout, so 0 waits for the answer. */
-export const NO_DEADLINE = 0
-
-/** A failure no amount of waiting fixes. */
-export class KickoffFailure extends Error {}
-
-/** The person chose to go on without setup while the start was still waiting. */
-export class KickoffSkipped extends KickoffFailure {}
-
-type FailureKind = 'fatal' | 'starting' | 'transient'
-
-function failureKind(error: unknown): FailureKind {
- if (
- error instanceof KickoffFailure ||
- error instanceof JsonRpcGatewayError ||
- error instanceof GatewayReauthRequiredError
- ) {
- return 'fatal'
- }
-
- // The renderer's own dial budget ran out while main still spawns the profile's backend. The spawn
- // goes on and answers with a connection or an error, so dialing again is waiting, not retrying.
- if (isTimeoutError(error)) {
- return 'starting'
- }
-
- // A socket that closed or reset under the call.
- return 'transient'
-}
-
-const describe = (error: unknown) => (error instanceof Error ? error.message : String(error))
-
-function log(line: string): void {
- const text = `[setup] kickoff ${line}`
- console.info(text)
- // Only error-level console lines reach desktop.log; testers read the transitions there.
- window.hermesDesktop?.logLine?.(text)
-}
-
-interface KickoffMachine {
- enter(next: KickoffState, detail?: string): void
- /** Runs `step` once the gateway is open. A dial that times out on a starting backend runs it again; a
- * dropped connection runs it again once. Anything else, or the backend exiting, rejects. */
- attempt<T>(state: KickoffState, step: () => Promise<T>): Promise<T>
- dispose(): void
- /** Aborts every call that carries `signal` and fails the kickoff with `reason`. */
- stop(reason: KickoffFailure): void
- /** Passed to every kickoff RPC, so `stop` rejects the ones still in flight and any started after it. */
- signal: AbortSignal
-}
-
-export function createKickoffMachine(): KickoffMachine {
- let state: KickoffState | 'begin' = 'begin'
- let exitFailure: KickoffFailure | null = null
- const exitWaiters = new Set<(error: KickoffFailure) => void>()
- const stopper = new AbortController()
- let stopReason: KickoffFailure | null = null
-
- const stop = (reason: KickoffFailure) => {
- stopReason = reason
- stopper.abort(reason)
-
- for (const reject of exitWaiters) {
- reject(reason)
- }
- }
-
- const enter = (next: KickoffState, detail?: string) => {
- log(`${state} -> ${next}${detail ? ` (${detail})` : ''}`)
- state = next
- }
-
- const offExit = window.hermesDesktop?.onBackendExit(({ code, signal }) => {
- // A gateway switch stops the old backend on purpose.
- if ($gatewaySwitching.get()) {
- return
- }
-
- exitFailure = new KickoffFailure(
- `The Hermes backend stopped before the welcome chat opened (code ${code ?? 'none'}, signal ${signal ?? 'none'}).`
- )
-
- for (const reject of exitWaiters) {
- reject(exitFailure)
- }
- })
-
- const gatewayOpen = (): Promise<void> => {
- if (stopReason) {
- return Promise.reject(stopReason)
- }
-
- if (exitFailure) {
- return Promise.reject(exitFailure)
- }
-
- if ($gatewayState.get() === 'open') {
- return Promise.resolve()
- }
-
- enter('waiting-backend', `gateway ${$gatewayState.get()}`)
-
- return new Promise((resolve, reject) => {
- const stopState = $gatewayState.listen(next => {
- if (next === 'open') {
- settle()
- resolve()
- }
- })
-
- const fail = (error: KickoffFailure) => {
- settle()
- reject(error)
- }
-
- function settle() {
- stopState()
- exitWaiters.delete(fail)
- }
-
- exitWaiters.add(fail)
- })
- }
-
- const attempt = async <T>(next: KickoffState, step: () => Promise<T>): Promise<T> => {
- let retried = false
- let detail: string | undefined
-
- for (;;) {
- await gatewayOpen()
- enter(next, detail)
-
- try {
- return await step()
- } catch (error) {
- const kind = failureKind(error)
-
- if (stopReason) {
- throw stopReason
- }
-
- if (exitFailure) {
- throw exitFailure
- }
-
- if (kind === 'fatal' || (kind === 'transient' && retried)) {
- throw error
- }
-
- retried ||= kind === 'transient'
- detail = `${kind === 'starting' ? 'backend still starting' : 'retry'}: ${describe(error)}`
- }
- }
- }
-
- return { attempt, dispose: () => offExit?.(), enter, signal: stopper.signal, stop }
-}
diff --git a/apps/desktop/src/app/contrib/onboarding-kickoff.ts b/apps/desktop/src/app/contrib/onboarding-kickoff.ts
deleted file mode 100644
index 780bf485861..00000000000
--- a/apps/desktop/src/app/contrib/onboarding-kickoff.ts
+++ /dev/null
@@ -1,276 +0,0 @@
-import type { OnboardingEnsureSetupProfileResult, OnboardingEnsureSetupSessionResult } from '@hermes/shared'
-import { useCallback } from 'react'
-
-import type { useSessionActions } from '@/app/session/hooks/use-session-actions'
-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-session'
-import type { ChatMessagePart } from '@/lib/chat-messages'
-import { isOnboardingEnabled } from '@/lib/onboarding-enabled'
-import { BACKEND_BOOT_WAIT_TIMEOUT_MS } from '@/lib/with-timeout'
-import { prefetchConnectorCatalog } from '@/store/connector-catalog'
-import { activeGatewayConnectionId, requestGatewayForProfile } from '@/store/gateway'
-import { notify } from '@/store/notifications'
-import { $setupProfileName, type GuideKickoffResult } from '@/store/onboarding-gate'
-import { $introStartExit } from '@/store/onboarding-intro'
-import { prefetchOnboardingPlugins } from '@/store/onboarding-plugins'
-import {
- $activeGatewayProfile,
- $newChatProfile,
- $newChatRoute,
- ensureGatewayAgent,
- ensureGatewayProfile
-} from '@/store/profile'
-import { $activeSessionId, $selectedStoredSessionId } from '@/store/session'
-import { $sessionStates } from '@/store/session-states'
-
-import { createKickoffMachine, KickoffFailure, KickoffSkipped, NO_DEADLINE } from './onboarding-kickoff-machine'
-import type { AmbientGatewayRequest } from './session-rpc-dispatcher'
-
-function prefetchGuideCatalogs(storedId: null | string): void {
- if (storedId) {
- prefetchConnectorCatalog(storedId)
- prefetchOnboardingPlugins(storedId)
- }
-}
-
-/** 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>
-
-interface OnboardingKickoffOptions extends Pick<ReturnType<typeof useSessionActions>, 'resumeSession'> {
- requestGateway: AmbientGatewayRequest
- runSlashCommand: KickoffSlashCommand
-}
-
-interface SetupStatus {
- ready?: boolean
- provider_configured?: boolean
- free_tier_route?: boolean
-}
-
-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,
- storedId: string,
- freeTierRoute: SetupStatus['free_tier_route'],
- resumeSession: OnboardingKickoffOptions['resumeSession'],
- guideRequest: AmbientGatewayRequest
-): Promise<string> {
- await resumeSession(storedId, true)
- const adoptedRuntimeId = $activeSessionId.get()
- const state = adoptedRuntimeId ? $sessionStates.get()[adoptedRuntimeId] : undefined
-
- if (
- !adoptedRuntimeId ||
- !state?.storedSessionId ||
- $selectedStoredSessionId.get() !== state.storedSessionId ||
- $activeGatewayProfile.get() !== setupProfile
- ) {
- throw new Error('The welcome conversation could not be loaded. Please try again.')
- }
-
- $chatOnboardingThreadIds.set([...new Set([storedId, state.storedSessionId, adoptedRuntimeId])])
- $setupSession.set({
- connectionId: guideSourceConnectionId(storedId),
- profile: setupProfile,
- runtimeId: adoptedRuntimeId,
- storedId
- })
- prefetchGuideCatalogs(storedId)
-
- if (freeTierRoute) {
- await guideRequest('config.set', {
- session_id: adoptedRuntimeId,
- key: 'reasoning',
- value: 'minimal'
- })
- }
-
- return adoptedRuntimeId
-}
-
-export function useOnboardingKickoff({ requestGateway, resumeSession, runSlashCommand }: OnboardingKickoffOptions) {
- return useCallback(async (): Promise<GuideKickoffResult> => {
- if (!isOnboardingEnabled()) {
- return 'off'
- }
-
- const previousNewChatProfile = $newChatProfile.get()
- const previousNewChatRoute = $newChatRoute.get()
- const previousProfile = $activeGatewayProfile.get()
- const previousConnectionId = activeGatewayConnectionId()
- const previousSetupSession = $setupSession.get()
- const previousThreadIds = $chatOnboardingThreadIds.get()
- const machine = createKickoffMachine()
- let swapped = false
-
- // Past the boot budget the start keeps waiting, and the starting screen offers a way out.
- const offerExit = window.setTimeout(
- () =>
- $introStartExit.set(() =>
- machine.stop(new KickoffSkipped('Setup was skipped while Hermes was still starting.'))
- ),
- BACKEND_BOOT_WAIT_TIMEOUT_MS
- )
-
- try {
- // Every call here is idempotent, so a retry repeats the whole step. The calls carry no deadline: a cold
- // first boot answers them late, and the machine fails on the signals that mean it never will.
- const prepared = await machine.attempt('preparing', async () => {
- const { name: setupProfile } = await requestGateway<OnboardingEnsureSetupProfileResult>(
- 'onboarding.ensure_setup_profile',
- {},
- NO_DEADLINE,
- machine.signal
- )
-
- $setupProfileName.set(setupProfile)
-
- // Foreground: the user is watching the starting screen, so a cold spawn of the setup profile's
- // backend takes the reserved slot and skips the background redial cooldown.
- const record = await requestGatewayForProfile<SetupStatus>(
- setupProfile,
- 'setup.status',
- {},
- NO_DEADLINE,
- machine.signal,
- { spawnPriority: 'foreground' }
- )
-
- if (record.ready !== true || record.provider_configured !== true) {
- // A retry after the swap saw a ready provider the first time; the swap has to be undone.
- if (swapped) {
- throw new KickoffFailure('Inference stopped reporting ready while the welcome chat opened.')
- }
-
- return null
- }
-
- if (!swapped) {
- takeGuideShape()
- rememberLaunchSource()
- swapped = true
- $newChatRoute.set(null)
- $newChatProfile.set(setupProfile)
- }
-
- await ensureGatewayProfile(setupProfile)
-
- // 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',
- {},
- NO_DEADLINE,
- machine.signal
- )
-
- return { record, setupChat, setupProfile }
- })
-
- if (!prepared) {
- machine.enter('off', 'no inference ready')
-
- return 'off'
- }
-
- const { record, setupChat, setupProfile } = prepared
-
- // The way out covers the waits only. Opening switches the session and cannot be cancelled halfway, so a
- // stop there would roll back under a resume that still lands on the setup chat.
- window.clearTimeout(offerExit)
- $introStartExit.set(null)
-
- machine.enter('opening', `session ${setupChat.session_id}`)
-
- const guideRequest: AmbientGatewayRequest = (method, params, timeout) =>
- requestGatewayForProfile(setupProfile, method, params, timeout)
-
- const runtimeId = await adoptGuideSession(
- setupProfile,
- setupChat.session_id,
- record.free_tier_route,
- resumeSession,
- guideRequest
- )
-
- // 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)
- )
- }
-
- machine.enter('started')
-
- return 'started'
- } catch (error) {
- machine.enter('failed', error instanceof Error ? error.message : String(error))
- $newChatProfile.set(previousNewChatProfile)
- $newChatRoute.set(previousNewChatRoute)
- $setupSession.set(previousSetupSession)
- $chatOnboardingThreadIds.set(previousThreadIds)
- endChatOnboardingSolo()
-
- if (swapped) {
- await (
- previousConnectionId
- ? ensureGatewayAgent(previousConnectionId, previousProfile)
- : ensureGatewayProfile(previousProfile)
- ).catch(restoreError => {
- notify({ kind: 'error', title: 'Could not restore your profile', message: String(restoreError) })
- })
- }
-
- // Going on without setup is the person's choice, not an error to report.
- if (!(error instanceof KickoffSkipped)) {
- console.error('[setup] welcome chat could not start', error)
- notify({
- kind: 'error',
- title: 'Welcome chat needs attention',
- message: error instanceof Error ? error.message : 'The welcome chat could not start.'
- })
- }
-
- return 'failed'
- } finally {
- window.clearTimeout(offerExit)
- $introStartExit.set(null)
- machine.dispose()
- }
- }, [requestGateway, resumeSession, runSlashCommand])
-}
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.ts
index 8a926751f36..e6d9296b1a5 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
@@ -206,10 +206,7 @@ export function useSlashCommand(deps: SlashCommandDeps) {
const compressInFlightRef = useRef(new Set<string>())
return useCallback(
- async (
- rawCommand: string,
- options?: { hidden?: boolean; sessionId?: string; recordInput?: boolean; typed?: boolean }
- ) => {
+ async (rawCommand: string, options?: { 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
@@ -407,14 +404,7 @@ 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.
- // `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 })
- })
+ await submitPromptText(message, { sessionId, storedSessionId, displayText })
}
try {
diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/submit.ts b/apps/desktop/src/app/session/hooks/use-prompt-actions/submit.ts
index a80ef647843..668309eb771 100644
--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/submit.ts
+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/submit.ts
@@ -775,7 +775,7 @@ export function useSubmitPrompt(deps: SubmitPromptDeps) {
if (!sessionId) {
try {
- sessionId = await createBackendSessionForSend(bubbleText, undefined, {
+ sessionId = await createBackendSessionForSend(bubbleText, {
onComposerScopeAssigned: options?.onComposerScopeAssigned
})
} catch (err) {
diff --git a/apps/desktop/src/app/session/hooks/use-session-actions/create-overrides.ts b/apps/desktop/src/app/session/hooks/use-session-actions/create-overrides.ts
index 27c9698b91a..c240b4c4e8c 100644
--- a/apps/desktop/src/app/session/hooks/use-session-actions/create-overrides.ts
+++ b/apps/desktop/src/app/session/hooks/use-session-actions/create-overrides.ts
@@ -1,56 +1,9 @@
-/**
- * Per-create overrides, translated to `session.create` params and folded over
- * the ones `desktopSessionCreateParams` derived from the visible selection.
- *
- * Reasoning effort rides alone here, with no model pin: the guided onboarding
- * chat wants `minimal` on whatever model the backend already resolved for the
- * profile. A model override would be a different kind of thing — the
- * composer's model and provider are a PAIR, so overriding one without the
- * other mints a session pointing a provider at a model it does not serve — and
- * no caller needs one.
- */
export interface SessionCreateOverrides {
/** Renderer-only handoff, fired at the stored-id assignment before navigation. */
onComposerScopeAssigned?: (scope: string) => void
- reasoningEffort?: string
- title?: string
}
export type CreateBackendSessionForSend = (
preview?: string | null,
- seedMessages?: SessionSeedMessage[],
createOverrides?: SessionCreateOverrides
) => Promise<string | null>
-
-export interface SessionSeedMessage {
- content: string
- display_kind?: 'hidden'
- role: 'assistant' | 'user'
-}
-
-export interface SessionCreateOverrideParams {
- messages?: SessionSeedMessage[]
- reasoning_effort?: string
- title?: string
-}
-
-export function sessionCreateOverrideParams(
- overrides: SessionCreateOverrides | undefined,
- seedMessages?: SessionSeedMessage[]
-): SessionCreateOverrideParams {
- const params: SessionCreateOverrideParams = {}
-
- if (overrides?.title) {
- params.title = overrides.title
- }
-
- if (overrides?.reasoningEffort) {
- params.reasoning_effort = overrides.reasoningEffort
- }
-
- if (seedMessages?.length) {
- params.messages = seedMessages
- }
-
- return params
-}
diff --git a/apps/desktop/src/app/session/hooks/use-session-actions/index.ts b/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
index 32f42ef42fc..3052e48c684 100644
--- a/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
+++ b/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
@@ -162,7 +162,7 @@ import {
import { singleFlightSessionResume } from '../use-prompt-actions/single-flight-resume'
import { branchCreateKey } from './branch-create-key'
-import { sessionCreateOverrideParams, type SessionCreateOverrides, type SessionSeedMessage } from './create-overrides'
+import type { SessionCreateOverrides } from './create-overrides'
import { markSessionCreatedThisRun, sessionCreatedThisRun } from './created-this-run'
import { captureDisplayHydration } from './display-hydration'
import { reconcilePersistedLiveTurn } from './persisted-live-turn'
@@ -648,16 +648,7 @@ export function useSessionActions({
)
const createBackendSessionForSend = useCallback(
- async (
- preview: string | null = null,
- seedMessages?: SessionSeedMessage[],
- // Create the session titled or at a pinned reasoning effort (guided
- // onboarding mints its welcome chat this way). The owning profile is NOT
- // an override — point $newChatProfile at it first (selectProfile-style)
- // so the create lands on that profile's own backend and every later
- // ambient RPC follows.
- createOverrides?: SessionCreateOverrides
- ): Promise<string | null> => {
+ async (preview: string | null = null, createOverrides?: SessionCreateOverrides): Promise<string | null> => {
const startingStoredSessionId = selectedStoredSessionIdRef.current
const startingRouteToken = getRouteToken()
@@ -690,10 +681,7 @@ export function useSessionActions({
const capturedProfile = $newChatProfile.get() || normalizeProfileKey($activeGatewayProfile.get())
const legacyProfileIntent = isLegacyNewChatProfile(capturedProfile)
- const params = {
- ...(await desktopSessionCreateParams(cwd, capturedRoute, capturedProfile, legacyProfileIntent)),
- ...sessionCreateOverrideParams(createOverrides, seedMessages)
- }
+ const params = await desktopSessionCreateParams(cwd, capturedRoute, capturedProfile, legacyProfileIntent)
// Lease the owner socket for the whole create → owner-publication
// sequence (#93602 primitive). The per-request lease inside
diff --git a/apps/desktop/src/components/assistant-ui/thread/message-parts-connectors.test.tsx b/apps/desktop/src/components/assistant-ui/thread/message-parts-connectors.test.tsx
index a6997fd3490..3d55586fe9d 100644
--- a/apps/desktop/src/components/assistant-ui/thread/message-parts-connectors.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/thread/message-parts-connectors.test.tsx
@@ -10,7 +10,6 @@ import { $connectionRequests, type ConnectionRequest, setConnectionRequest } fro
import { $gateway } from '@/store/gateway'
import { _resetSessionOwnerHintsForTests, setSessionOwnerHint } from '@/store/session'
-// jsdom has no preload bridge, so isOnboardingEnabled() is false here: the card must not depend on it.
// Runtime id (events, operation store) and stored id (owner hints) differ in the app.
const SESSION_ID = 'runtime-1'
const STORED_ID = 'stored-1'
diff --git a/apps/desktop/src/components/assistant-ui/thread/setup-learned.tsx b/apps/desktop/src/components/assistant-ui/thread/setup-learned.tsx
deleted file mode 100644
index 0c1ef69e023..00000000000
--- a/apps/desktop/src/components/assistant-ui/thread/setup-learned.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import type { FC } from 'react'
-
-// tui_gateway/start_chat.py::_setup_learned: the block a setup handoff appends
-// under the user's ask. The model reads all of it; the bubble shows only the ask.
-const SETUP_LEARNED_MARKER = '\n\nWhat setup learned about me:\n'
-
-/** `[ask, block]`: the block is null for every message that has none. */
-export function splitSetupLearned(text: string): [string, null | string] {
- const index = text.indexOf(SETUP_LEARNED_MARKER)
-
- return index < 0 ? [text, null] : [text.slice(0, index), text.slice(index + 2)]
-}
-
-export const SetupLearnedNote: FC<{ text: string }> = ({ text }) => {
- const [title = '', ...lines] = text.split('\n')
-
- return (
- <details className="mb-2 text-[0.75rem] text-muted-foreground" data-slot="aui_setup-learned">
- <summary className="cursor-pointer select-none hover:text-foreground/70">{title.replace(/:$/, '')}</summary>
- <div className="mt-1 whitespace-pre-line leading-5 text-foreground/75">{lines.join('\n')}</div>
- </details>
- )
-}
diff --git a/apps/desktop/src/components/assistant-ui/thread/status.tsx b/apps/desktop/src/components/assistant-ui/thread/status.tsx
index 46297cc61ff..d9ebf1575f4 100644
--- a/apps/desktop/src/components/assistant-ui/thread/status.tsx
+++ b/apps/desktop/src/components/assistant-ui/thread/status.tsx
@@ -8,7 +8,6 @@ import { toolPresentVerb } from '@/components/assistant-ui/tool/run-summary'
import { useElapsedSeconds } from '@/components/chat/activity-timer'
import { ActivityTimerText } from '@/components/chat/activity-timer-text'
import { SCAFFOLD_LABEL_CLASS } from '@/components/chat/scaffold-row'
-import { useOnboardingChatActive } from '@/components/onboarding-chat/assembly'
import { Codicon } from '@/components/ui/codicon'
import { Loader } from '@/components/ui/loader'
import { StatusPulse } from '@/components/ui/status-pulse'
@@ -370,9 +369,7 @@ const TurnActivityRow: FC<TurnActivityRowProps> = ({ active, elapsed, hint, loca
export const TurnActivityIndicator: FC<{ thinking?: boolean }> = ({ thinking = false }) => {
// Same rule the reasoning disclosure renders by (message-parts.tsx).
const showReasoning = useStore($showReasoning)
- const guidedChat = useOnboardingChatActive()
- const reasoningShown = showReasoning && !guidedChat
- const activity = useAuiState(s => activitySignature(s.message.content, reasoningShown))
+ const activity = useAuiState(s => activitySignature(s.message.content, showReasoning))
// Timestamp of the last visible progress, held from the moment the quiet
// spell qualifies. Holding the timestamp (not a boolean) is what lets the
@@ -446,7 +443,7 @@ export const TurnActivityIndicator: FC<{ thinking?: boolean }> = ({ thinking = f
// A reply that has only thought so far, with the thinking not drawn, has
// still put nothing on screen: it keeps the pre-first-token row.
- if (thinking && !reasoningShown) {
+ if (thinking && !showReasoning) {
return <ResponseLoadingIndicator />
}
diff --git a/apps/desktop/src/components/assistant-ui/thread/turn-activity.ts b/apps/desktop/src/components/assistant-ui/thread/turn-activity.ts
index ad3d2624ab7..a93392b56cb 100644
--- a/apps/desktop/src/components/assistant-ui/thread/turn-activity.ts
+++ b/apps/desktop/src/components/assistant-ui/thread/turn-activity.ts
@@ -45,8 +45,8 @@ export function activitySignature(content: readonly ActivityPart[], reasoningSho
let settledTools = 0
for (const part of content) {
- // Reasoning the transcript does not draw (the guided chat, or the user
- // turned it off) is the model thinking in silence, not progress on screen.
+ // Reasoning the transcript does not draw (the user turned it off) is the
+ // model thinking in silence, not progress on screen.
if (!reasoningShown && part.type === 'reasoning') {
continue
}
diff --git a/apps/desktop/src/components/assistant-ui/thread/user-message.tsx b/apps/desktop/src/components/assistant-ui/thread/user-message.tsx
index 99413ee0c37..9e35f85a85b 100644
--- a/apps/desktop/src/components/assistant-ui/thread/user-message.tsx
+++ b/apps/desktop/src/components/assistant-ui/thread/user-message.tsx
@@ -10,7 +10,6 @@ import {
} from '@/components/assistant-ui/thread/content'
import { MessageHoverTime } from '@/components/assistant-ui/thread/message-hover-time'
import { ReactionBadge, ReactionPicker } from '@/components/assistant-ui/thread/message-reactions'
-import { SetupLearnedNote, splitSetupLearned } from '@/components/assistant-ui/thread/setup-learned'
import { BackgroundResult } from '@/components/assistant-ui/thread/system-message'
import { threadUserOrdinal } from '@/components/assistant-ui/thread/thread-message-index'
import { MessageTimelineTimestamp } from '@/components/assistant-ui/thread/timeline-timestamp'
@@ -320,8 +319,7 @@ export const UserMessage: FC<{
const copy = t.assistant.thread
const messageId = useAuiState(s => s.message.id)
const content = useAuiState(s => s.message.content)
- const fullText = messageContentText(content)
- const [messageText, setupLearned] = splitSetupLearned(fullText)
+ const messageText = messageContentText(content)
const threadRunning = useAuiState(s => s.thread.isRunning)
const latestUserId = useAuiState(s => {
@@ -483,14 +481,11 @@ export const UserMessage: FC<{
// it. No negative margin: -mt-* pulls the row up into the sticky box,
// where the sticky-prompt clip hides its top even at rest. Image refs
// render as thumbnails, file refs as chips; no border.
- <>
- {attachmentRefs.length > 0 && !chipOnlyTurn && (
- <div className="mb-2 flex flex-wrap gap-1">
- <DirectiveContent text={attachmentRefs.join(' ')} />
- </div>
- )}
- {setupLearned && <SetupLearnedNote text={setupLearned} />}
- </>
+ attachmentRefs.length > 0 && !chipOnlyTurn ? (
+ <div className="mb-2 flex flex-wrap gap-1">
+ <DirectiveContent text={attachmentRefs.join(' ')} />
+ </div>
+ ) : null
}
messageId={messageId}
>
@@ -581,7 +576,7 @@ export const UserMessage: FC<{
Restore. Its fill masks the last line's tail while shown. */}
<div className="pointer-events-none absolute right-2 bottom-2 z-10 flex items-center gap-1 rounded-md bg-(--dt-user-bubble) pl-1 opacity-0 transition-opacity group-hover/user-message:opacity-100 group-hover/user-message:transition-none group-focus-within/user-message:opacity-100">
<UserBubbleActions
- fullText={fullText}
+ fullText={messageText}
messageId={messageId}
onCancel={onCancel}
onRequestRestoreConfirm={onRequestRestoreConfirm}
diff --git a/apps/desktop/src/components/onboarding-chat/assembly.ts b/apps/desktop/src/components/onboarding-chat/assembly.ts
deleted file mode 100644
index 39653230d2f..00000000000
--- a/apps/desktop/src/components/onboarding-chat/assembly.ts
+++ /dev/null
@@ -1,223 +0,0 @@
-import { useStore } from '@nanostores/react'
-import { atom } from 'nanostores'
-
-import { useSessionView } from '@/app/chat/session-view'
-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,
- $layoutTree,
- $userPlacedPanes,
- adoptContributedPanes,
- dismissTreePane,
- markActivePreset,
- persistTree,
- resetEnforcedDocks,
- undismissTreePanes
-} from '@/components/pane-shell/tree/store'
-import { registry } from '@/contrib/registry'
-import { isOnboardingEnabled } from '@/lib/onboarding-enabled'
-import { useStoreSelector } from '@/lib/use-session-slice'
-import { $interfaceMode, type InterfaceMode, modeLayout, setInterfaceMode } from '@/store/interface-mode'
-import { setSidebarOpen } from '@/store/layout'
-import { $chatOnboardingSolo, $introView } from '@/store/onboarding-intro'
-import { $paneStates, type PaneStateSnapshot } from '@/store/panes'
-import { $activeSessionId, $selectedStoredSessionId } from '@/store/session'
-
-// 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 $chatLayoutPicked = atom(false)
-
-let previousLayout: {
- id: string
- tree: LayoutNode | null
- panes: Record<string, PaneStateSnapshot>
- placed: ReadonlySet<string>
-} | null = null
-
-export function takeGuideShape(): void {
- if ($chatOnboardingSolo.get()) {
- return
- }
-
- startChatOnboardingSolo()
-
- if ($chatOnboardingSolo.get()) {
- window.hermesDesktop?.chatOnboarding?.size('onboarding')
- }
-}
-
-function startChatOnboardingSolo(): void {
- if (!isOnboardingEnabled() || $chatOnboardingSolo.get()) {
- return
- }
-
- previousLayout = {
- id: $activePresetId.get(),
- tree: $layoutTree.get(),
- panes: $paneStates.get(),
- placed: $userPlacedPanes.get()
- }
- $chatOnboardingSolo.set(true)
- $chatLayoutPicked.set(false)
- 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)
- 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 = previousLayout
- previousLayout = null
-
- if (previous) {
- const tree = previous.tree ?? registry.getArea('layouts').find(preset => preset.id === 'default')?.data
-
- if (tree) {
- $layoutTree.set(tree as LayoutNode)
- $paneStates.set(previous.panes)
- $userPlacedPanes.set(previous.placed)
- markActivePreset(previous.tree ? previous.id : 'default')
- persistTree()
- }
- }
-}
-
-function reconcileLayout(id: string, tree: LayoutNode): void {
- applyLayoutPreset(id, tree)
-
- const declared = new Set(allPaneIds(tree))
-
- undismissTreePanes(declared)
-
- const dismissUndeclared = () => {
- for (const paneId of new Set([
- ...allPaneIds($layoutTree.get() ?? tree),
- ...registry.getArea('panes').map(pane => pane.id)
- ])) {
- if (!declared.has(paneId)) {
- dismissTreePane(paneId)
- }
- }
- }
-
- setSidebarOpen(true)
-
- resetEnforcedDocks()
- adoptContributedPanes()
-
- dismissUndeclared()
-}
-
-export function assembleChatOnboarding(id: string, tree: LayoutNode, mode?: InterfaceMode): void {
- $chatOnboardingSolo.set(false)
-
- if (mode && mode !== $interfaceMode.get()) {
- restorePreviousLayout()
- setInterfaceMode(mode)
- }
-
- previousLayout = null
-
- window.hermesDesktop?.chatOnboarding?.size('normal')
-
- reconcileLayout(id, tree)
-}
-
-export function snapshotChatLayout(): () => void {
- const snapshot = {
- id: $activePresetId.get(),
- mode: $interfaceMode.get(),
- panes: $paneStates.get(),
- picked: $chatLayoutPicked.get(),
- placed: $userPlacedPanes.get(),
- previous: previousLayout,
- solo: $chatOnboardingSolo.get(),
- tree: $layoutTree.get()
- }
-
- return () => {
- if (snapshot.mode !== $interfaceMode.get()) {
- 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)
- $userPlacedPanes.set(snapshot.placed)
- markActivePreset(snapshot.id)
- persistTree()
- }
-
- previousLayout = snapshot.previous
- $chatLayoutPicked.set(snapshot.picked)
- }
-}
-
-/** 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 ||
- (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 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)
-
- const inThread = useStoreSelector($chatOnboardingThreadIds, ids =>
- [runtimeId, storedId].some(id => id != null && ids.includes(id))
- )
-
- return (view.kind === 'primary' && solo) || (intro && inThread)
-}
diff --git a/apps/desktop/src/components/onboarding-chat/gate.test.tsx b/apps/desktop/src/components/onboarding-chat/gate.test.tsx
deleted file mode 100644
index f098cc69a43..00000000000
--- a/apps/desktop/src/components/onboarding-chat/gate.test.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import type { OnboardingStateResult } from '@hermes/shared'
-import { cleanup, render, waitFor } from '@testing-library/react'
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-
-// The gate's stores are module singletons; each test loads a fresh window's worth.
-async function loadWindow() {
- vi.resetModules()
-
- const [{ OnboardingChatGate }, gate, onboarding] = await Promise.all([
- import('./gate'),
- import('@/store/onboarding-gate'),
- import('@/store/onboarding')
- ])
-
- return { OnboardingChatGate, gate, onboarding }
-}
-
-const UNSEEN_STATE: OnboardingStateResult = { eligible: true, intro: 'unseen', failed_starts: 0, profile: 'setup' }
-
-const unseenFirstRun = async <T,>(method: string): Promise<T> => {
- const reply = method === 'onboarding.state' ? UNSEEN_STATE : {}
-
- // SAFETY: the gate reads `onboarding.state` as OnboardingStateResult; any other call only awaits the reply.
- return reply as T
-}
-
-const neverKicksOff = () => new Promise<never>(() => {})
-
-beforeEach(() => {
- Object.assign(window, { hermesDesktop: { guestOnboardingEnabled: true } })
-})
-
-afterEach(() => {
- cleanup()
- Reflect.deleteProperty(window, 'hermesDesktop')
-})
-
-describe('OnboardingChatGate', () => {
- it('lets a window that does not run the intro open the provider picker once the state is read', async () => {
- const { OnboardingChatGate, gate, onboarding } = await loadWindow()
-
- onboarding.requestDesktopOnboarding('No provider configured')
- render(<OnboardingChatGate enabled onKickoff={neverKicksOff} requestGateway={unseenFirstRun} runsIntro={false} />)
-
- await waitFor(() => expect(onboarding.$desktopOnboarding.get().requested).toBe(true))
- expect(gate.$onboardingGate.get().phase).toBe('idle')
- expect(gate.$setupProfileName.get()).toBe('setup')
- })
-
- it('queues the guided first run in the window that runs the intro', async () => {
- const { OnboardingChatGate, gate, onboarding } = await loadWindow()
-
- onboarding.requestDesktopOnboarding('No provider configured')
- render(<OnboardingChatGate enabled onKickoff={neverKicksOff} requestGateway={unseenFirstRun} runsIntro />)
-
- await waitFor(() => expect(gate.$onboardingStateRead.get()).toBe(true))
- expect(gate.$onboardingGate.get().phase).toBe('pending')
- expect(onboarding.$desktopOnboarding.get().requested).toBe(false)
- })
-})
diff --git a/apps/desktop/src/components/onboarding-chat/gate.tsx b/apps/desktop/src/components/onboarding-chat/gate.tsx
deleted file mode 100644
index 505c9edd566..00000000000
--- a/apps/desktop/src/components/onboarding-chat/gate.tsx
+++ /dev/null
@@ -1,100 +0,0 @@
-import type { OnboardingStateResult } from '@hermes/shared'
-import { useStore } from '@nanostores/react'
-import { useEffect } from 'react'
-
-import { isOnboardingEnabled } from '@/lib/onboarding-enabled'
-import { ackFreeTierNotice, type FreeTierRequester } from '@/store/free-tier'
-import { clearFreeTierIntro } from '@/store/onboarding'
-import {
- $onboardingGate,
- $setupProfileName,
- abandonGuide,
- beginOnboardingFlow,
- type GuideKickoffResult,
- markOnboardingStateRead,
- runGuideKickoff
-} from '@/store/onboarding-gate'
-import { $introView } from '@/store/onboarding-intro'
-
-import { failIntro, startIntro } from './intro'
-
-interface OnboardingChatGateProps {
- enabled: boolean
- onKickoff: () => Promise<GuideKickoffResult>
- requestGateway: FreeTierRequester
- /** Only the main window runs the intro. Every window still reads the state: the provider picker,
- * the free-tier introduction and the usage-stats offer wait on that read (afterOnboardingStateRead). */
- runsIntro: boolean
-}
-
-export function OnboardingChatGate({ enabled, onKickoff, requestGateway, runsIntro }: OnboardingChatGateProps) {
- const gate = useStore($onboardingGate)
-
- useEffect(() => {
- if (!enabled || !isOnboardingEnabled()) {
- return
- }
-
- void requestGateway<OnboardingStateResult>('onboarding.state')
- .then(
- state => {
- $setupProfileName.set(state.profile ?? null)
-
- if (!runsIntro) {
- return
- }
-
- beginOnboardingFlow(state)
-
- if ($onboardingGate.get().guideQueued) {
- startIntro()
- }
- },
- error => console.warn('[onboarding] state could not be read', error)
- )
- .finally(markOnboardingStateRead)
- }, [enabled, requestGateway, runsIntro])
-
- useEffect(() => {
- if (!enabled || !isOnboardingEnabled()) {
- return
- }
-
- const ack = () => {
- clearFreeTierIntro()
- void ackFreeTierNotice(requestGateway).then(acked => {
- if (acked) {
- clearFreeTierIntro()
- }
- })
- }
-
- return $introView.subscribe(view => {
- if (view === 'intro') {
- ack()
- }
- })
- }, [enabled, requestGateway])
-
- useEffect(() => {
- // No deadline here: the kickoff waits while the backend is known to be coming and settles itself on
- // the states it cannot wait out (onboarding-kickoff-machine.ts).
- if (enabled && gate.guideQueued) {
- const recover = (result: Exclude<GuideKickoffResult, 'started'>) => {
- failIntro()
- abandonGuide(result)
- }
-
- void runGuideKickoff(onKickoff).then(
- result => {
- if (result !== 'started') {
- recover(result)
- }
- },
- () => recover('failed')
- )
- }
- }, [enabled, gate.guideQueued, onKickoff])
-
- return null
-}
diff --git a/apps/desktop/src/components/onboarding-chat/intro-copy.css b/apps/desktop/src/components/onboarding-chat/intro-copy.css
deleted file mode 100644
index f3d5ec2cba2..00000000000
--- a/apps/desktop/src/components/onboarding-chat/intro-copy.css
+++ /dev/null
@@ -1,91 +0,0 @@
-/* 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);
-}
-
-/* The thread waits under the copy until the spring settles (`$introHoldsThread`). */
-[data-intro-holding] > [data-slot='thread'] {
- visibility: hidden;
-}
-
-/* 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;
- }
-}
-
-/* The composer dock fades in once the setup guide has arrived (data-guide-arrived on the chat). */
-@keyframes guide-controls-arrive {
- from {
- opacity: 0;
- }
- to {
- opacity: 1;
- }
-}
-
-[data-guide-arrived] [data-slot='composer-dock'] {
- animation: guide-controls-arrive 100ms ease-out;
-}
-
-@media (prefers-reduced-motion: reduce) {
- [data-guide-arrived] [data-slot='composer-dock'] {
- animation: none;
- }
-}
diff --git a/apps/desktop/src/components/onboarding-chat/intro-copy.tsx b/apps/desktop/src/components/onboarding-chat/intro-copy.tsx
deleted file mode 100644
index b84f0dff510..00000000000
--- a/apps/desktop/src/components/onboarding-chat/intro-copy.tsx
+++ /dev/null
@@ -1,118 +0,0 @@
-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.test.ts b/apps/desktop/src/components/onboarding-chat/intro.test.ts
deleted file mode 100644
index e3f8be8f26f..00000000000
--- a/apps/desktop/src/components/onboarding-chat/intro.test.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-
-import { stopTour } from '@/lib/tour'
-import { $tourActive } from '@/lib/tour/tour-active'
-import { $onboardingGate } from '@/store/onboarding-gate'
-import { $selectedStoredSessionId } from '@/store/session'
-import { $toursEnabled } from '@/store/tours'
-
-import { $chatOnboardingThreadIds } from './assembly'
-import { finishGuidedOnboarding } from './intro'
-
-const SETUP = 'setup-chat'
-const TASK = 'task-chat'
-
-describe('finishGuidedOnboarding handoff tour', () => {
- beforeEach(() => {
- vi.useFakeTimers()
- // jsdom lays nothing out; the tour only targets a rail with a size.
- vi.spyOn(Element.prototype, 'getBoundingClientRect').mockReturnValue(new DOMRect(0, 0, 10, 10))
- document.body.innerHTML = '<div data-tour="profile-rail"></div>'
- $chatOnboardingThreadIds.set([SETUP])
- $onboardingGate.set({ guideKickoff: 'idle', guideQueued: false, phase: 'left' })
- $toursEnabled.set(true)
- $selectedStoredSessionId.set(SETUP)
- })
-
- afterEach(async () => {
- await stopTour()
- vi.useRealTimers()
- vi.restoreAllMocks()
- })
-
- it('opens the tour over the task chat the watched handoff opened', async () => {
- finishGuidedOnboarding(SETUP, TASK)
- $selectedStoredSessionId.set(TASK)
- await vi.advanceTimersByTimeAsync(10_000)
-
- expect($tourActive.get()).toBe(true)
- })
-
- it('opens no tour when the setup chat finished in the background', async () => {
- $selectedStoredSessionId.set('other-chat')
-
- finishGuidedOnboarding(SETUP, TASK)
- await vi.advanceTimersByTimeAsync(10_000)
-
- expect($tourActive.get()).toBe(false)
- })
-
- it('opens no tour when the user moved to another chat before the handoff opened', async () => {
- finishGuidedOnboarding(SETUP, TASK)
- $selectedStoredSessionId.set('other-chat')
- await vi.advanceTimersByTimeAsync(10_000)
-
- expect($tourActive.get()).toBe(false)
- })
-})
diff --git a/apps/desktop/src/components/onboarding-chat/intro.ts b/apps/desktop/src/components/onboarding-chat/intro.ts
deleted file mode 100644
index a4ea30023fa..00000000000
--- a/apps/desktop/src/components/onboarding-chat/intro.ts
+++ /dev/null
@@ -1,183 +0,0 @@
-import { atom, computed } 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 { $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 { isStartChatCallerWatched } from '@/store/start-chat'
-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.
- */
-type IntroCopyStage = 'hidden' | 'landed' | 'playing'
-
-export const $introCopy = atom<IntroCopyStage>('hidden')
-
-/** While the copy types and springs up, the thread under it stays hidden: the backend's first row and the
- * card after it can land early, and a see-through chat surface (glass) would show them mid-motion. */
-export const $introHoldsThread = computed($introCopy, stage => stage === 'playing')
-
-/** 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, `set_theme`, 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 tutorial tips. The local-setup offer still arms: its card waits for a finished task.
- retireTips(TIP_CATALOG.map(tip => tip.id))
- selectProfile(launch?.profile ?? 'default')
-}
-
-/** A setup chat's `start_chat` started the task chat (`startedId`): the guided first run is complete. */
-export function finishGuidedOnboarding(runtimeId: string, startedId: string): void {
- const threads = $chatOnboardingThreadIds.get()
- const storedId = storedSessionIdForRuntimeId(runtimeId)
-
- if (!threads.includes(runtimeId) && !(storedId && threads.includes(storedId))) {
- return
- }
-
- const { phase } = $onboardingGate.get()
- // The task chat opens itself only for a watched caller (start-chat-tool.tsx). A setup chat that
- // finished in the background opens nothing, so it must not open a tour either.
- const handoffOpens = isStartChatCallerWatched(storedId ?? runtimeId)
-
- endIntroView()
- completeGuide()
-
- if (handoffOpens && (phase === 'guided' || phase === 'left') && $toursEnabled.get()) {
- void showHandoffTour(() => $selectedStoredSessionId.get() === startedId)
- }
-}
-
-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-session.ts b/apps/desktop/src/components/onboarding-chat/setup-session.ts
deleted file mode 100644
index b3f5a175836..00000000000
--- a/apps/desktop/src/components/onboarding-chat/setup-session.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { atom } from 'nanostores'
-
-import { activeGatewayConnectionId } from '@/store/gateway'
-import { getSessionOwnerHint } from '@/store/session'
-
-export interface SetupSession {
- connectionId: null | string
- profile: string
- runtimeId: string
- storedId: null | string
-}
-
-export const $setupSession = atom<null | SetupSession>(null)
-
-export function guideSourceConnectionId(guideStoredId: null | string | undefined): null | string {
- return (guideStoredId && getSessionOwnerHint(guideStoredId)?.connectionId) || activeGatewayConnectionId() || null
-}
diff --git a/apps/desktop/src/components/onboarding-chat/signpost.ts b/apps/desktop/src/components/onboarding-chat/signpost.ts
deleted file mode 100644
index e77b11d8dbd..00000000000
--- a/apps/desktop/src/components/onboarding-chat/signpost.ts
+++ /dev/null
@@ -1,95 +0,0 @@
-import { translateNow } from '@/i18n'
-import { readLocalSetupEligibility } from '@/store/local-setup-offer'
-
-/** Tour handles (`data-tour`). A targets scan returns these same selectors, so a curated step and a
- * model-driven step point at the same node. */
-const RAIL = '[data-tour="profile-rail"]'
-const SESSIONS = '[data-tour="sessions-sidebar"]'
-const MODEL_PILL = '[data-tour="model-pill"]'
-
-/** Eligibility is one status + catalog read, usually already cached. The tour does not wait longer than this. */
-const LOCAL_FIT_WAIT_MS = 1500
-
-/** Waits for a visible node. The profile rail mounts a render or two after the handoff switches profiles, and
- * the tour engine returns a no-match for a selector that is not in the DOM yet. Returns false on timeout. */
-async function waitFor(selector: string, timeoutMs = 6000, ready = () => true): Promise<boolean> {
- const deadline = Date.now() + timeoutMs
-
- while (Date.now() < deadline) {
- const visible =
- ready() &&
- [...document.querySelectorAll(selector)].some(node => {
- const { width, height } = node.getBoundingClientRect()
-
- return width > 0 && height > 0 && !node.closest('[data-pane-hidden]')
- })
-
- if (visible) {
- return true
- }
-
- await new Promise(resolve => setTimeout(resolve, 120))
- }
-
- return false
-}
-
-/** The caller does not await this, so the tour does not delay the handoff. `onHandoffChat` is true while the
- * started task chat is the one on screen: the tour waits for it to open and drops if the user moves on. */
-export async function showHandoffTour(onHandoffChat: () => boolean): Promise<void> {
- if (!(await waitFor(RAIL, 6000, onHandoffChat))) {
- return
- }
-
- const [sessionsVisible, localModel, pillVisible] = await Promise.all([
- waitFor(SESSIONS, 1500),
- localStepModel(),
- waitFor(MODEL_PILL, 1500)
- ])
-
- const localVisible = localModel !== null && pillVisible
- const copy = (key: string, ...args: unknown[]) => translateNow(`handoffTour.${key}`, ...args)
- // Imported here instead of at the top: this module is reachable from the boot path through intro.ts
- // (finishGuidedOnboarding), and run-tour.ts keeps driver.js and its stylesheet out of that path.
- const { startTour } = await import('@/lib/tour')
-
- if (!onHandoffChat()) {
- return
- }
-
- await startTour([
- { accent: true, selector: RAIL, side: 'right', text: copy('profileText'), title: copy('profileTitle') },
- ...(sessionsVisible
- ? [{ selector: SESSIONS, side: 'right' as const, text: copy('sessionsText'), title: copy('sessionsTitle') }]
- : []),
- { accent: true, selector: RAIL, side: 'right', text: copy('stayText'), title: copy('stayTitle') },
- ...(localVisible
- ? [
- {
- accent: true,
- selector: MODEL_PILL,
- side: 'top' as const,
- text: copy('localText', localModel),
- title: copy('localTitle')
- }
- ]
- : [])
- ])
-}
-
-/** Display name of the model this machine can run, or null when it doesn't qualify or the read is slow. */
-async function localStepModel(): Promise<null | string> {
- let timer: ReturnType<typeof setTimeout> | undefined
-
- const timeout = new Promise<null>(resolve => {
- timer = setTimeout(() => resolve(null), LOCAL_FIT_WAIT_MS)
- })
-
- const fit = readLocalSetupEligibility().then(({ fit }) => fit?.model.display_name ?? null)
-
- try {
- return await Promise.race([fit, timeout])
- } finally {
- clearTimeout(timer)
- }
-}
diff --git a/apps/desktop/src/components/onboarding-chat/skip.tsx b/apps/desktop/src/components/onboarding-chat/skip.tsx
deleted file mode 100644
index f06b8d9dc83..00000000000
--- a/apps/desktop/src/components/onboarding-chat/skip.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { useStore } from '@nanostores/react'
-
-import { Tip } from '@/components/ui/tooltip'
-import { $introView } from '@/store/onboarding-intro'
-
-import { skipIntro } from './intro'
-
-export function OnboardingSkip() {
- const intro = useStore($introView) === 'intro'
-
- if (!intro) {
- return null
- }
-
- return (
- <Tip label="Switching you over to your default profile">
- <button
- className="ml-auto text-[11px] text-(--ui-text-quaternary) transition-colors hover:text-(--ui-text-secondary)"
- onClick={skipIntro}
- type="button"
- >
- Skip setup
- </button>
- </Tip>
- )
-}
diff --git a/apps/desktop/src/components/pane-shell/tree/presets.ts b/apps/desktop/src/components/pane-shell/tree/presets.ts
index cb27fdd757f..10bcdc2ef49 100644
--- a/apps/desktop/src/components/pane-shell/tree/presets.ts
+++ b/apps/desktop/src/components/pane-shell/tree/presets.ts
@@ -27,8 +27,6 @@ export const LAYOUTS_AREA = 'layouts'
*/
export interface LayoutPresetSpec extends Tiered {
id: string
- /** `false` keeps a preset off every picker and out of `set_theme`; only its owner applies it. */
- listed?: false
order: number
resting?: readonly string[]
title: string
@@ -43,14 +41,7 @@ export function registerBundledPresets(bundled: readonly LayoutPresetSpec[]) {
}
return registry.registerMany(
- bundled.map(({ id, listed, order, title, tree }) => ({
- id,
- area: LAYOUTS_AREA,
- title,
- order,
- data: tree,
- ...(listed === false && { enabled: false })
- }))
+ bundled.map(({ id, order, title, tree }) => ({ id, area: LAYOUTS_AREA, title, order, data: tree }))
)
}
diff --git a/apps/desktop/src/components/pane-shell/tree/renderer/floating-panes.tsx b/apps/desktop/src/components/pane-shell/tree/renderer/floating-panes.tsx
index 890b85ca463..ee6eae46f3c 100644
--- a/apps/desktop/src/components/pane-shell/tree/renderer/floating-panes.tsx
+++ b/apps/desktop/src/components/pane-shell/tree/renderer/floating-panes.tsx
@@ -13,7 +13,6 @@ import { type PointerEvent as ReactPointerEvent, useCallback, useEffect, useRef
import { HUD_SURFACE } from '@/app/floating-hud'
import { TITLEBAR_HEIGHT } from '@/app/shell/titlebar'
-import { useOnboardingChatActive } from '@/components/onboarding-chat/assembly'
import { Codicon } from '@/components/ui/codicon'
import { ContribBoundary, ContribRender } from '@/contrib/react/boundary'
import { useContributions } from '@/contrib/react/use-contributions'
@@ -211,11 +210,7 @@ export function FloatingPanes() {
const panes = useContributions('panes')
const hidden = useStore($hiddenTreePanes)
- const onboardingActive = useOnboardingChatActive()
-
- const floating = onboardingActive
- ? []
- : panes.filter(pane => paneChrome(pane).placement === FLOATING_PLACEMENT && !hidden.has(pane.id))
+ const floating = panes.filter(pane => paneChrome(pane).placement === FLOATING_PLACEMENT && !hidden.has(pane.id))
if (floating.length === 0) {
return null
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.tsx
index df98f5e9c41..09c3f2b3aa6 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
@@ -15,7 +15,6 @@ 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 '../..'
@@ -47,7 +46,6 @@ export function narrowOverlayWidth(ctx: TrackContext, tree: LayoutNode | null, r
export function NarrowOverlays() {
const narrow = useStore($narrowViewport)
- const solo = useStore($chatOnboardingSolo)
const tree = useStore($layoutTree)
const panes = useContributions('panes')
const paneStates = useStore($paneStates)
@@ -83,10 +81,8 @@ export function NarrowOverlays() {
const inTree = useMemo(() => new Set(tree ? allPaneIds(tree) : []), [tree])
const collapsibles = useMemo(
- // Solo adopts sidebar panes without their surrounding sidebar chrome.
- // Suppress every reveal path while those panes are intentionally hidden.
- () => (solo ? [] : panes.filter(p => paneChrome(p).collapsible && inTree.has(p.id) && !hiddenPanes.has(p.id))),
- [solo, panes, inTree, hiddenPanes]
+ () => panes.filter(p => paneChrome(p).collapsible && inTree.has(p.id) && !hiddenPanes.has(p.id)),
+ [panes, inTree, hiddenPanes]
)
const collapsiblesRef = useRef(collapsibles)
@@ -95,7 +91,7 @@ export function NarrowOverlays() {
// ⌘B / ⌘G's narrow branch dispatches the app's toggle-reveal event with the
// REAL pane id — accept those via each contribution's revealAliases.
useEffect(() => {
- if (!narrow || solo) {
+ if (!narrow) {
setReveal(null)
return
@@ -147,9 +143,9 @@ export function NarrowOverlays() {
window.removeEventListener(PANE_TOGGLE_REVEAL_EVENT, onToggle)
window.removeEventListener('keydown', onKeyDown)
}
- }, [narrow, solo])
+ }, [narrow])
- if (!narrow || solo || collapsibles.length === 0) {
+ if (!narrow || collapsibles.length === 0) {
return null
}
diff --git a/apps/desktop/src/lib/layout-persistence.ts b/apps/desktop/src/lib/layout-persistence.ts
index 2c94b4b18fb..6e5a2a5415e 100644
--- a/apps/desktop/src/lib/layout-persistence.ts
+++ b/apps/desktop/src/lib/layout-persistence.ts
@@ -67,7 +67,6 @@ export function createLayoutPersistence(initialMode: InterfaceMode, persistent:
const snapshots = new Set<string>()
let mode = initialMode
let restoring = false
- let held = false
const legacy = persistent ? migrateLayoutScopes(initialMode) : new Map<string, string>()
@@ -77,7 +76,7 @@ export function createLayoutPersistence(initialMode: InterfaceMode, persistent:
if (!restoring) {
snapshots.add(keyFor(key))
- if (persistent && !held) {
+ if (persistent) {
// Explicit empties keep migration retries from reviving cleared state.
writeKey(keyFor(key), mode === 'simple' ? (raw ?? 'null') : raw)
}
@@ -141,11 +140,6 @@ 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/connector-catalog.ts b/apps/desktop/src/store/connector-catalog.ts
deleted file mode 100644
index 64857974cfa..00000000000
--- a/apps/desktop/src/store/connector-catalog.ts
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * The live connector catalog for a chat session, read once per session and cached.
- *
- * The onboarding picker used to be a hardcoded list, and it drifted from the
- * deployed catalog: it offered apps the gateway does not carry and spelled
- * others with hyphens the gateway does not use. The build chat then had to
- * tell the user the pick could not be connected. This hook asks the gateway
- * what is there, through the account-owned RPC the Connectors page uses, on
- * the backend that owns the session, so the picker can only offer what can be
- * connected. The session-owned list answers for the session's own tools, and
- * the setup profile carries only its beat tools, so it always said no.
- *
- * `available: false` (toolset off, signed out), a failed request, and a
- * request that takes longer than 15 s all resolve to `unavailable`; the caller
- * decides what to show. There is no fallback list here, because a fallback is
- * how the drift started. Missing session ids resolve to `unavailable` too,
- * and the probe runs once they arrive, so the card never waits on a request
- * that was never sent.
- */
-import type { ConnectorRow } from '@hermes/shared'
-import { useQuery } from '@tanstack/react-query'
-
-import { resolveSessionOwner } from '@/app/session/hooks/use-session-actions/utils'
-import { translateNow } from '@/i18n'
-import { isMissingRpcMethod, isOutOfSyncRpcParams } from '@/lib/gateway-rpc'
-import { queryClient } from '@/lib/query-client'
-import { requestGatewayForAgent } from '@/store/gateway'
-import { notifyError } from '@/store/notifications'
-import { $activeGatewayProfile } from '@/store/profile'
-import { assertSessionOwnerResolved } from '@/store/session-owner-resolution'
-import { isSessionOwnerRoute } from '@/store/session-request-router'
-
-type ConnectorCatalog = { status: 'loading' } | { status: 'ready'; rows: ConnectorRow[] } | { status: 'unavailable' }
-
-/** The picks card remounts on every transcript rebuild (each hidden submit, each turn end), so the read is
- * held in the query cache per session: a remount paints the rows it already has instead of flashing back to
- * the skeleton for another round trip. */
-async function readConnectorCatalog(storedId: string): Promise<ConnectorCatalog> {
- try {
- const scope = await resolveSessionOwner(storedId)
- assertSessionOwnerResolved(scope, { method: 'connectors.list', sessionId: storedId })
- const connectionId = isSessionOwnerRoute(scope) ? scope.connectionId : null
- const profile = isSessionOwnerRoute(scope) ? scope.profile : scope || $activeGatewayProfile.get()
-
- const response = await requestGatewayForAgent<{ available: boolean; connectors: ConnectorRow[] }>(
- connectionId,
- profile,
- 'connectors.list',
- { owner: { type: 'account' } },
- 15000
- )
-
- return response.available ? { rows: response.connectors, status: 'ready' } : { status: 'unavailable' }
- } catch (error) {
- if (isMissingRpcMethod(error) || isOutOfSyncRpcParams(error instanceof Error ? error : String(error))) {
- notifyError(error, translateNow('connectors.unavailable'), { id: 'connectors-rpc-out-of-sync' })
- }
-
- return { status: 'unavailable' }
- }
-}
-
-const catalogKey = (storedId: null | string) => ['onboarding', 'connectors.list', storedId] as const
-
-/** Start the read when the guide session opens: cold, it takes several seconds, and the card that needs it is
- * two turns away. */
-export function prefetchConnectorCatalog(storedId: string): void {
- void queryClient.prefetchQuery({
- queryFn: () => readConnectorCatalog(storedId),
- queryKey: catalogKey(storedId),
- staleTime: Infinity
- })
-}
-
-export function useConnectorCatalog(storedId: null | string): ConnectorCatalog {
- const query = useQuery({
- enabled: Boolean(storedId),
- queryFn: () => readConnectorCatalog(storedId!),
- queryKey: catalogKey(storedId),
- // Only a list is kept: an `unavailable` read from before the setup card minted a guest identity is read
- // again when the card mounts, and shows as loading meanwhile, not as the dead end it was.
- staleTime: ({ state }) => (state.data?.status === 'ready' ? Infinity : 0)
- })
-
- if (!storedId) {
- return { status: 'unavailable' }
- }
-
- return query.data && !(query.data.status === 'unavailable' && query.isFetching) ? query.data : { status: 'loading' }
-}
diff --git a/apps/desktop/src/store/onboarding-answers.ts b/apps/desktop/src/store/onboarding-answers.ts
deleted file mode 100644
index 152a9027365..00000000000
--- a/apps/desktop/src/store/onboarding-answers.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { atom } from 'nanostores'
-
-import { readJson, writeJson } from '@/lib/storage'
-
-export interface OnboardingAnswers {
- accent: null | string
-}
-
-const ANSWERS_KEY = 'hermes-onboarding-wizard-answers-v1'
-
-export const DEFAULT_ANSWERS: OnboardingAnswers = { accent: null }
-
-function loadAnswers(): OnboardingAnswers {
- const raw = readJson<Partial<OnboardingAnswers>>(ANSWERS_KEY)
-
- return { accent: raw?.accent ?? DEFAULT_ANSWERS.accent }
-}
-
-export const $onboardingAnswers = atom<OnboardingAnswers>(loadAnswers())
-
-export function setOnboardingAnswers(patch: Partial<OnboardingAnswers>): void {
- const next = { ...$onboardingAnswers.get(), ...patch }
-
- $onboardingAnswers.set(next)
- writeJson(ANSWERS_KEY, next)
-}
diff --git a/apps/desktop/src/store/onboarding-gate.ts b/apps/desktop/src/store/onboarding-gate.ts
deleted file mode 100644
index b8f8a14b6eb..00000000000
--- a/apps/desktop/src/store/onboarding-gate.ts
+++ /dev/null
@@ -1,190 +0,0 @@
-import type { OnboardingStateResult } from '@hermes/shared'
-import { atom, computed } from 'nanostores'
-
-import { isOnboardingEnabled } from '@/lib/onboarding-enabled'
-
-import { $gateway } from './gateway'
-import { DEFAULT_ANSWERS, setOnboardingAnswers } from './onboarding-answers'
-import { resetTips } from './tips'
-
-// `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.
-const ONBOARDING_PHASES = ['idle', 'pending', 'guided', 'left', 'skipped', 'done'] as const
-
-export type OnboardingPhase = (typeof ONBOARDING_PHASES)[number]
-
-export type GuideKickoffResult = 'started' | 'off' | 'failed'
-
-export interface OnboardingGateState {
- phase: OnboardingPhase
- guideQueued: boolean
- guideKickoff: 'idle' | 'starting' | 'started'
-}
-
-type GuideKickoff =
- { status: 'idle' } | { status: 'starting'; promise: Promise<GuideKickoffResult> } | { status: 'started' }
-
-export const $onboardingGate = atom<OnboardingGateState>({ phase: 'idle', guideQueued: false, guideKickoff: 'idle' })
-
-/** `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)
-
-let guideKickoff: GuideKickoff = { status: 'idle' }
-
-const guidedPhase = (phase: OnboardingPhase) => phase === 'pending' || phase === 'guided'
-
-/**
- * Guided first run is behind the user: finished, skipped, or never due. The phase is only
- * trusted once the backend's `onboarding.state` (its `intro`) has been read.
- */
-export const $guidedOnboardingSettled = computed(
- [$onboardingGate, $onboardingStateRead],
- (gate, read) => !isOnboardingEnabled() || (read && !guidedPhase(gate.phase))
-)
-
-export const $guideOpening = computed(
- $onboardingGate,
- gate =>
- isOnboardingEnabled() && (gate.phase === 'pending' || gate.phase === 'guided') && gate.guideKickoff !== 'started'
-)
-
-function setGuideKickoff(state: GuideKickoff): void {
- guideKickoff = state
- $onboardingGate.set({ ...$onboardingGate.get(), guideKickoff: state.status })
-}
-
-function setPhase(phase: OnboardingPhase): void {
- $onboardingGate.set({ ...$onboardingGate.get(), phase, guideQueued: false })
-}
-
-function reportOnboarding(method: 'onboarding.mark_seen' | 'onboarding.record_failed_start'): void {
- void $gateway
- .get()
- ?.request(method, {})
- .catch(error => console.warn(`[onboarding] ${method} failed`, error))
-}
-
-export function guidedOnboardingActive(): boolean {
- const { phase } = $onboardingGate.get()
-
- return isOnboardingEnabled() && guidedPhase(phase)
-}
-
-export function markOnboardingStateRead(): void {
- $onboardingStateRead.set(true)
-}
-
-export function afterOnboardingStateRead(run: () => void): void {
- if (!isOnboardingEnabled() || $onboardingStateRead.get()) {
- run()
-
- return
- }
-
- const stop = $onboardingStateRead.listen(() => {
- stop()
- run()
- })
-}
-
-export function beginOnboardingFlow(state: OnboardingStateResult): void {
- if (!isOnboardingEnabled() || !state.eligible || state.intro !== 'unseen' || $onboardingGate.get().phase !== 'idle') {
- return
- }
-
- setPhase('pending')
- $onboardingGate.set({ ...$onboardingGate.get(), guideQueued: true })
-}
-
-export function runGuideKickoff(kickoff: () => Promise<GuideKickoffResult>): Promise<GuideKickoffResult> {
- if (!isOnboardingEnabled()) {
- return Promise.resolve('off')
- }
-
- if (guideKickoff.status === 'starting') {
- return guideKickoff.promise
- }
-
- if (guideKickoff.status === 'started') {
- return Promise.resolve('started')
- }
-
- if (!$onboardingGate.get().guideQueued) {
- return Promise.resolve('off')
- }
-
- const promise = Promise.resolve()
- .then(kickoff)
- .then(
- result => {
- setGuideKickoff({ status: result === 'started' ? 'started' : 'idle' })
-
- if (result === 'started' && $onboardingGate.get().phase === 'pending') {
- setPhase('guided')
- }
-
- return result
- },
- error => {
- setGuideKickoff({ status: 'idle' })
-
- throw error
- }
- )
-
- setGuideKickoff({ status: 'starting', promise })
-
- return promise
-}
-
-/** 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()
-
- if (isOnboardingEnabled() && (phase === 'pending' || phase === 'guided')) {
- setPhase('skipped')
- reportOnboarding('onboarding.mark_seen')
- }
-}
-
-export function abandonGuide(result: Exclude<GuideKickoffResult, 'started'>): void {
- const { phase } = $onboardingGate.get()
-
- if (isOnboardingEnabled() && (phase === 'pending' || phase === 'guided')) {
- setPhase('skipped')
-
- if (result === 'failed') {
- reportOnboarding('onboarding.record_failed_start')
- }
- }
-}
-
-/** 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 })
- // 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.ts
deleted file mode 100644
index 17fb2454c0b..00000000000
--- a/apps/desktop/src/store/onboarding-intro.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-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`.
- */
-type IntroView = 'off' | 'starting' | 'intro' | 'ended'
-
-export const $introView = atom<IntroView>('off')
-
-/** Set once the setup chat's start has outlasted the boot budget: the starting screen keeps waiting and offers
- * this way out, which ends the start through the kickoff's failed path. Null otherwise. */
-export const $introStartExit = atom<(() => void) | null>(null)
-
-/** 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-plugins.ts b/apps/desktop/src/store/onboarding-plugins.ts
deleted file mode 100644
index f5413abc050..00000000000
--- a/apps/desktop/src/store/onboarding-plugins.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import type { OnboardingCatalogPlugin } from '@hermes/shared'
-import { useQuery } from '@tanstack/react-query'
-
-import { resolveSessionOwner } from '@/app/session/hooks/use-session-actions/utils'
-import { queryClient } from '@/lib/query-client'
-import { requestGatewayForAgent } from '@/store/gateway'
-import { $activeGatewayProfile } from '@/store/profile'
-import { isSessionOwnerRoute } from '@/store/session-request-router'
-
-export type OnboardingPlugin = OnboardingCatalogPlugin
-
-export const pluginNeedsApp = (plugin: OnboardingPlugin): boolean => plugin.app_state === 'missing_app'
-
-async function readOnboardingPlugins(storedId: string): Promise<OnboardingPlugin[]> {
- try {
- const scope = await resolveSessionOwner(storedId)
- const connectionId = isSessionOwnerRoute(scope) ? scope.connectionId : null
- const profile = isSessionOwnerRoute(scope) ? scope.profile : scope || $activeGatewayProfile.get()
-
- const response = await requestGatewayForAgent<{ onboarding?: OnboardingPlugin[] | null }>(
- connectionId,
- profile,
- 'plugins.manage',
- { action: 'onboarding' },
- 20000
- )
-
- return response.onboarding ?? []
- } catch {
- return []
- }
-}
-
-const pluginsKey = (storedId: null | string) => ['onboarding', 'plugins.manage:onboarding', storedId] as const
-
-export function prefetchOnboardingPlugins(storedId: string): void {
- void queryClient.prefetchQuery({
- queryFn: () => readOnboardingPlugins(storedId),
- queryKey: pluginsKey(storedId),
- staleTime: Infinity
- })
-}
-
-export function useOnboardingPluginList(storedId: null | string): null | OnboardingPlugin[] {
- const query = useQuery({
- enabled: Boolean(storedId),
- queryFn: () => readOnboardingPlugins(storedId!),
- queryKey: pluginsKey(storedId),
- staleTime: Infinity
- })
-
- return query.data ?? null
-}
diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.css
index 219de061127..894d3edafa8 100644
--- a/apps/desktop/src/styles.css
+++ b/apps/desktop/src/styles.css
@@ -1178,17 +1178,6 @@
padding-top: calc(var(--titlebar-height) + 1rem);
}
-/* The setup chat is a first conversation read at arm's length in a small
- window, so its transcript, cards and composer run a size up. It sets the
- base tokens: the thread and composer scopes derive the final ones from
- these times the chat text scale. */
-[data-setup-chat] {
- --conversation-text-base-size: 0.9375rem;
- --conversation-tool-base-size: 0.75rem;
- --conversation-caption-base-size: 0.8125rem;
- --conversation-base-line-height: 1.375rem;
-}
-
@keyframes arc-border {
/* Transform travel (compositor-only), never background-position: the old
background-position version cost ~3,600 main-thread style recalcs per