The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(onboarding): accept custom colors in the existing picker
brooklyn!4c203de493ce
diff --git a/apps/desktop/src/components/onboarding-chat/cards/frame.tsx b/apps/desktop/src/components/onboarding-chat/cards/frame.tsxindex f6425f726a3..4df988f5d11 100644--- a/apps/desktop/src/components/onboarding-chat/cards/frame.tsx+++ b/apps/desktop/src/components/onboarding-chat/cards/frame.tsx@@ -14,6 +14,8 @@ import { $onboardingAnswers, markStepCommitted } from '@/store/onboarding-answerexport interface CardProps {/** The directive's raw attrs, written by the model. */attrs: Record<string, string>+ /** Stable transcript identity for one-time application of model-supplied choices. */+ messageId?: string/** True while the surrounding turn is still streaming; the card renders but does not accept clicks. */locked: boolean}diff --git a/apps/desktop/src/components/onboarding-chat/cards/setup.tsx b/apps/desktop/src/components/onboarding-chat/cards/setup.tsxindex 63acfa18104..621e4b39114 100644--- a/apps/desktop/src/components/onboarding-chat/cards/setup.tsx+++ b/apps/desktop/src/components/onboarding-chat/cards/setup.tsx@@ -5,7 +5,7 @@*/import { useStore } from '@nanostores/react'-import { useMemo, useState } from 'react'+import { useEffect, useMemo, useState } from 'react'import { useSessionView } from '@/app/chat/session-view'import { $chatLayoutPicked, assembleChatOnboarding } from '@/components/onboarding-chat/assembly'@@ -28,6 +28,7 @@ import { useConnectorCatalog } from '@/store/connector-catalog'import { $onboardingAnswers, setOnboardingAnswers } from '@/store/onboarding-answers'import { useTheme } from '@/themes'import { setAccentOverride } from '@/themes/accent-override'+import { normalizeHex } from '@/themes/color'export function ConnectorsCard({ locked }: CardProps) {const view = useSessionView()@@ -124,7 +125,23 @@ export function ConnectorsCard({ locked }: CardProps) {)}-export function LookCard({ locked }: CardProps) {+function pickAccent(value: string, receipt?: string): void {+ const hex = normalizeHex(value)++ if (!hex) {+ return+ }++ const accent = hex === NOUS_ACCENT ? null : hex++ setOnboardingAnswers({+ accent,+ ...(receipt ? { committed: [...$onboardingAnswers.get().committed, receipt] } : {})+ })+ setAccentOverride(accent)+}++export function LookCard({ attrs, locked, messageId }: CardProps) {const answers = useStore($onboardingAnswers)const { renderedMode } = useTheme()const { commit, done } = useCardCommit('look')@@ -132,11 +149,25 @@ export function LookCard({ locked }: CardProps) {const accent = answers.accent ?? NOUS_ACCENTconst picked = accents.find(swatch => swatch.hex === accent.toLowerCase())- const pickAccent = (hex: string) => {- const seed = hex === NOUS_ACCENT ? null : hex+ const requested = normalizeHex(attrs.value)+ const receipt = messageId && requested ? `look-color:${JSON.stringify([messageId, requested])}` : null++ useEffect(() => {+ if (locked || done) {+ return+ }++ if (requested && receipt && !answers.committed.includes(receipt)) {+ pickAccent(requested, receipt)+ } else {+ // Restore an unfinished choice without replaying a historical directive over a newer pick.+ setAccentOverride(answers.accent)+ }+ }, [answers.accent, answers.committed, done, locked, receipt, requested])- setOnboardingAnswers({ accent: seed })- setAccentOverride(seed)+ // Chat choices update the existing picker; they do not create a second question card.+ if (attrs.value !== undefined) {+ return null}return (@@ -151,6 +182,7 @@ export function LookCard({ locked }: CardProps) {onPick={() => pickAccent(swatch.hex)}/>))}+ <AccentSwatch active={!picked} hex={accent} name="Custom color" onColorChange={pickAccent} /></div></CardFrame>)diff --git a/apps/desktop/src/components/onboarding-chat/directive.tsx b/apps/desktop/src/components/onboarding-chat/directive.tsxindex fa6c99dc0cc..0731139dd0b 100644--- a/apps/desktop/src/components/onboarding-chat/directive.tsx+++ b/apps/desktop/src/components/onboarding-chat/directive.tsx@@ -4,8 +4,11 @@* a card. A step in neither table renders nothing. The cards live in ./cards.*/+import { useAuiState } from '@assistant-ui/react'+import { useStore } from '@nanostores/react'import { useEffect } from 'react'+import { useSessionView } from '@/app/chat/session-view'import { FirstBuildCard, HandoffCard, ProgressCard } from '@/components/onboarding-chat/cards/build'import type { CardProps } from '@/components/onboarding-chat/cards/frame'import { ConnectorsCard, LayoutCard, LookCard } from '@/components/onboarding-chat/cards/setup'@@ -45,6 +48,11 @@ function DataDirective({ field, value }: { field: AnswerField; value: string })}export function OnboardingChatDirective({ attrs, streaming }: { attrs: Record<string, string>; streaming: boolean }) {+ const view = useSessionView()+ const storedId = useStore(view.$storedId)+ const runtimeId = useStore(view.$runtimeId)+ const messageId = useAuiState(state => state.message.id)+ const identity = JSON.stringify([storedId ?? runtimeId, messageId])const step = attrs.step ?? ''const field = DATA_STEPS.get(step)@@ -57,5 +65,5 @@ export function OnboardingChatDirective({ attrs, streaming }: { attrs: Record<st// Mount as soon as the directive is parsed. Returning null until the turn settles would grow the transcript by a// card when the turn finishes. The card stays inert while streaming so the growing paragraph cannot be clicked.- return Card ? <Card attrs={attrs} locked={streaming} /> : null+ return Card ? <Card attrs={attrs} locked={streaming} messageId={identity} /> : null}diff --git a/apps/desktop/src/components/onboarding-chat/options.tsx b/apps/desktop/src/components/onboarding-chat/options.tsxindex 79acc32bc9a..8767fc00887 100644--- a/apps/desktop/src/components/onboarding-chat/options.tsx+++ b/apps/desktop/src/components/onboarding-chat/options.tsx@@ -1,7 +1,9 @@import { selectableClass } from '@/components/onboarding-chat/chip'+import { Codicon } from '@/components/ui/codicon'import { Tip } from '@/components/ui/tooltip'import { IS_MAC } from '@/lib/keybinds/combo'import { cn } from '@/lib/utils'+import { readableInk } from '@/themes/color'// Curated leaders for the first-run picker. Other enabled catalog entries// remain searchable, so newly deployed connectors need no client list update.@@ -62,30 +64,43 @@ export function AccentSwatch({active,hex,name,+ onColorChange,onPick}: {active: booleanhex: stringname: string- onPick: () => void+ onColorChange?: (hex: string) => void+ onPick?: () => void}) {+ const className = cn(+ // The border keeps the mono swatch visible when its colour matches the background.+ 'relative inline-flex size-9 items-center justify-center rounded-full border border-foreground/15 transition-transform duration-150',+ !active && 'hover:scale-105'+ )+ const style = {+ background: hex,+ boxShadow: active ? `0 0 0 2px var(--dt-background), 0 0 0 4px ${hex}` : undefined+ }+return (<Tip label={name}>- <button- aria-label={name}- aria-pressed={active}- className={cn(- // The border keeps the mono swatch visible when its colour matches the background.- 'size-9 rounded-full border border-foreground/15 transition-transform duration-150',- !active && 'hover:scale-105'- )}- onClick={onPick}- style={{- background: hex,- boxShadow: active ? `0 0 0 2px var(--dt-background), 0 0 0 4px ${hex}` : undefined- }}- type="button"- />+ {onColorChange ? (+ <label className={cn(className, 'focus-within:outline-2 focus-within:outline-ring')} style={style}>+ <span className="flex" style={{ color: readableInk(hex) }}>+ <Codicon name="add" size="1rem" />+ </span>+ <input+ aria-label={name}+ className="absolute inset-0 size-full cursor-pointer opacity-0"+ onChange={event => onColorChange(event.target.value)}+ type="color"+ value={hex}+ />+ </label>+ ) : (+ <button aria-label={name} aria-pressed={active} className={className} onClick={onPick} style={style} type="button" />+ )}</Tip>)}diff --git a/apps/desktop/src/store/onboarding-script.ts b/apps/desktop/src/store/onboarding-script.tsindex f15f5cd0159..1afe370c27b 100644--- a/apps/desktop/src/store/onboarding-script.ts+++ b/apps/desktop/src/store/onboarding-script.ts@@ -147,7 +147,7 @@ export function buildChatOnboardingPrompt(suggestedName?: string | null, signedI: ['In that same turn, once, mention in ONE short clause that wiring those up later will want a model provider — a free Nous account is there if they want it, free tier, no card, and they can bring their own provider instead — then move straight on. Do not sell it, do not list providers, do not ask them to do it now, and do not repeat this sign-in nudge: they will be asked properly at the point it actually matters. Still explain the model picker and local option later; that is guidance, not another sign-in pitch.']),- 'If they type a custom colour instead of choosing a swatch, address it before moving on. A typed colour does not apply itself. Use only an available control or tool and confirm its result; never invent a directive attribute. If unsupported or failed, name the requested colour, say it was not applied and why (or that the cause is unknown), and keep the existing colour. Point back to supported swatches in the existing picker, not a silent substitute or another copy of the look card. Stay on this choice until they accept a colour, keep the current one, or ask to skip; an unsuccessful custom request does not complete the colour step.',+ 'If they request a custom colour, resolve it to a hex colour and emit ::onboarding{step="look" value="#rrggbb"} on its own line. The existing picker applies and saves it when the turn settles; its Continue button advances normally. Custom colours are supported. No explanation or extra question is needed.','3. Then their layout: one short sentence, then ::onboarding{step="layout"} on a line of its own.',`4. The app has just arranged itself around this chat. In at most two short sentences, explain that the model picker chooses what answers them and they can ask to set up a local model on this computer after the initial free usage. Skip the filler acknowledgment; save download details for when they choose local setup. No download, model switch, extra question or mandatory setup now. Then offer a look around with the line ::ask{question="${TOUR_QUESTION}" options="${TOUR_OPTIONS.basics}|${TOUR_OPTIONS.tour}|${TOUR_OPTIONS.none}"} alone as its own paragraph. Branch on the answer, then go straight to step 5 IN THE SAME TURN whichever they picked — the tour overlay has its own Done button and ending your turn on it strands them with nothing to click next.`,` - "${TOUR_OPTIONS.basics}": three steps, the essentials only — where their conversations live, where they ask for a job, and how to start a fresh one. Point at each and say one useful thing about it.`,