The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): onboarding card Continue stays Done after the transcript rebuilds
brooklyn!d5a4adbdacfc
diff --git a/apps/desktop/src/components/onboarding-chat/cards/build.tsx b/apps/desktop/src/components/onboarding-chat/cards/build.tsxindex 1dac2cabca8..0a70352daab 100644--- a/apps/desktop/src/components/onboarding-chat/cards/build.tsx+++ b/apps/desktop/src/components/onboarding-chat/cards/build.tsx@@ -7,7 +7,7 @@import { useAuiState } from '@assistant-ui/react'import { useStore } from '@nanostores/react'-import { useEffect, useMemo, useState } from 'react'+import { useEffect, useMemo } from 'react'import { requestComposerSubmit } from '@/app/chat/composer/focus'import { useSessionView } from '@/app/chat/session-view'@@ -29,6 +29,7 @@ import {import { Button } from '@/components/ui/button'import { segmentTranscriptDirectives } from '@/lib/transcript-directives'import { cn } from '@/lib/utils'+import { $onboardingAnswers, markStepCommitted } from '@/store/onboarding-answers'import { assertSessionOwnerResolved } from '@/store/session-owner-resolution'import { isSessionOwnerRoute } from '@/store/session-request-router'@@ -46,7 +47,10 @@ export function FirstBuildCard({ attrs, locked }: CardProps) {const view = useSessionView()const storedId = useStore(view.$storedId)const target = view.kind === 'tile' ? `tile:${storedId}` : 'main'- const [picked, setPicked] = useState<null | string>(null)+ // The pick lives with the other answers, not in component state: the+ // visible submit rebuilds the transcript and a local flag came back null,+ // leaving every chip clickable after one had already been sent.+ const picked = useStore($onboardingAnswers).committed.find(step => step.startsWith('first:'))?.slice(6) ?? null// Parse + validate the model's options: up to 4, each short enough to sit on// a chip, deduped case-insensitively (models repeat themselves). Garbage in@@ -78,7 +82,7 @@ export function FirstBuildCard({ attrs, locked }: CardProps) {}if (requestComposerSubmit(option, { target })) {- setPicked(option)+ markStepCommitted(`first:${option}`)}}diff --git a/apps/desktop/src/components/onboarding-chat/cards/frame.tsx b/apps/desktop/src/components/onboarding-chat/cards/frame.tsxindex 8b9e4e8d803..ed1d59fa7b6 100644--- a/apps/desktop/src/components/onboarding-chat/cards/frame.tsx+++ b/apps/desktop/src/components/onboarding-chat/cards/frame.tsx@@ -5,12 +5,12 @@*/import { useStore } from '@nanostores/react'-import { useState } from 'react'import { requestComposerSubmit } from '@/app/chat/composer/focus'import { useSessionView } from '@/app/chat/session-view'import { Button } from '@/components/ui/button'import { cn } from '@/lib/utils'+import { $onboardingAnswers, markStepCommitted } from '@/store/onboarding-answers'export interface CardProps {/** The directive's raw attrs — the model-written payload. */@@ -19,17 +19,20 @@ export interface CardProps {locked: boolean}-export function useCardCommit() {+/** `step` names the card so Done survives the card remounting: the hidden+ * submit and the turn-end hydrate both rebuild the transcript, and a flag in+ * component state came back false each time. */+export function useCardCommit(step: string) {const view = useSessionView()const storedId = useStore(view.$storedId)const target = view.kind === 'tile' ? `tile:${storedId}` : 'main'- const [done, setDone] = useState(false)+ const done = useStore($onboardingAnswers).committed.includes(step)const commit = (summary: string): boolean => {const sent = requestComposerSubmit(`[setup] ${summary}`, { displayKind: 'hidden', target })if (sent) {- setDone(true)+ markStepCommitted(step)}return sentdiff --git a/apps/desktop/src/components/onboarding-chat/cards/setup.tsx b/apps/desktop/src/components/onboarding-chat/cards/setup.tsxindex 2775a1b91d1..869472d716e 100644--- a/apps/desktop/src/components/onboarding-chat/cards/setup.tsx+++ b/apps/desktop/src/components/onboarding-chat/cards/setup.tsx@@ -27,7 +27,7 @@ import { setAccentOverride } from '@/themes/accent-override'export function ConnectorsCard({ locked }: CardProps) {const answers = useStore($onboardingAnswers)- const { commit, done } = useCardCommit()+ const { commit, done } = useCardCommit('connectors')const picked = CONNECTORS.filter(connector => answers.connectors.includes(connector.id))const toggle = (id: string) =>@@ -78,7 +78,7 @@ export function ConnectorsCard({ locked }: CardProps) {export function LookCard({ locked }: CardProps) {const answers = useStore($onboardingAnswers)const { renderedMode } = useTheme()- const { commit, done } = useCardCommit()+ const { commit, done } = useCardCommit('look')const accents = accentsFor(renderedMode === 'dark')const accent = answers.accent ?? NOUS_ACCENTconst picked = accents.find(swatch => swatch.hex === accent.toLowerCase())@@ -109,7 +109,7 @@ export function LookCard({ locked }: CardProps) {export function LayoutCard({ locked }: CardProps) {const answers = useStore($onboardingAnswers)- const { commit, done } = useCardCommit()+ const { commit, done } = useCardCommit('layout')// The stored answer defaults to 'basic', but the CHOICE is the point of this// step — nothing renders selected (and Continue stays off) until they click.// Store-backed: the pick's own layout apply remounts this card (the panediff --git a/apps/desktop/src/store/onboarding-answers.ts b/apps/desktop/src/store/onboarding-answers.tsindex 7e8de8ed1fe..fb7d5f59b67 100644--- a/apps/desktop/src/store/onboarding-answers.ts+++ b/apps/desktop/src/store/onboarding-answers.ts@@ -4,6 +4,11 @@ import { readJson, writeJson } from '@/lib/storage'export interface OnboardingAnswers {accent: null | string+ /** Cards the user has already pressed Continue on. The card's own React+ * state dies on every transcript reconcile (the hidden submit and the+ * turn-end hydrate both rebuild the message list), so a Done button that+ * lived there came back live and let the step be answered twice. */+ committed: string[]connectors: string[]context: stringname: string@@ -15,6 +20,7 @@ export const ANSWERS_KEY = 'hermes-onboarding-wizard-answers-v1'export const DEFAULT_ANSWERS: OnboardingAnswers = {accent: null,+ committed: [],connectors: [],context: '',name: '',@@ -28,6 +34,7 @@ export function loadAnswers(): OnboardingAnswers {// to personalization or written back on the next answer.return {accent: raw?.accent ?? DEFAULT_ANSWERS.accent,+ committed: raw?.committed ?? [...DEFAULT_ANSWERS.committed],connectors: raw?.connectors ?? [...DEFAULT_ANSWERS.connectors],context: raw?.context ?? DEFAULT_ANSWERS.context,name: raw?.name ?? DEFAULT_ANSWERS.name,@@ -43,3 +50,11 @@ export function setOnboardingAnswers(patch: Partial<OnboardingAnswers>): void {$onboardingAnswers.set(next)writeJson(ANSWERS_KEY, next)}++export function markStepCommitted(step: string): void {+ const { committed } = $onboardingAnswers.get()++ if (!committed.includes(step)) {+ setOnboardingAnswers({ committed: [...committed, step] })+ }+}