The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
style(desktop): one answeredAfter helper for the ask card and first-build chips
brooklyn!33a974d26ac5
diff --git a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsxindex 0ca0b90f4fb..fd6ab705051 100644--- a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx+++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx@@ -142,9 +142,10 @@ export function useStatusbarItems({const freeTier = useStore($freeTierStatus)// The chip is a standing invitation to sign in. During the guided first// launch that invitation lives on the guide's own ready screen; a second- // one in the statusbar is a distraction from the chat they are in.- const gatePhase = useStore($onboardingGate).phase- const guideOwnsSignIn = gatePhase !== 'idle' && guidedOnboardingActive()+ // one in the statusbar is a distraction from the chat they are in. The+ // subscription is what makes the check reactive.+ useStore($onboardingGate)+ const guideOwnsSignIn = guidedOnboardingActive()const updateStatus = useStore($updateStatus)const updateApply = useStore($updateApply)const backendUpdateStatus = useStore($backendUpdateStatus)diff --git a/apps/desktop/src/components/assistant-ui/ask-directive.tsx b/apps/desktop/src/components/assistant-ui/ask-directive.tsxindex 9b011a7f3db..5b4360e4990 100644--- a/apps/desktop/src/components/assistant-ui/ask-directive.tsx+++ b/apps/desktop/src/components/assistant-ui/ask-directive.tsx@@ -25,6 +25,7 @@ import { useState } from 'react'import { requestComposerSubmit } from '@/app/chat/composer/focus'import { useSessionView } from '@/app/chat/session-view'+import { answeredAfter } from '@/lib/chat-messages/parts'import { cn } from '@/lib/utils'// Picked questions, module-scoped: transcript virtualization remounts@@ -54,10 +55,7 @@ export function AskDirective({ attrs, streaming }: { attrs: Record<string, strin// buttons, so someone who answered in the composer came back to six live// chips under a question they had already dealt with. Any user message// after this one closes the ask.- const answeredInComposer = useStore(view.$messages).some(- (message, index, all) =>- message.role === 'user' && !message.hidden && index > all.findIndex(candidate => candidate.id === messageId)- )+ const answeredInComposer = answeredAfter(useStore(view.$messages), messageId)const closed = picked !== null || answeredInComposerdiff --git a/apps/desktop/src/components/onboarding-chat/cards/build.tsx b/apps/desktop/src/components/onboarding-chat/cards/build.tsxindex a40b8fa1442..c4c4d0adb16 100644--- a/apps/desktop/src/components/onboarding-chat/cards/build.tsx+++ b/apps/desktop/src/components/onboarding-chat/cards/build.tsx@@ -27,6 +27,7 @@ import {SETUP_PROFILE} from '@/components/onboarding-chat/setup-profile'import { Button } from '@/components/ui/button'+import { answeredAfter } from '@/lib/chat-messages/parts'import { segmentTranscriptDirectives } from '@/lib/transcript-directives'import { cn } from '@/lib/utils'import { $onboardingAnswers, markStepCommitted } from '@/store/onboarding-answers'@@ -53,10 +54,7 @@ export function FirstBuildCard({ attrs, locked }: CardProps) {// reply in the composer closes the card the same way a chip does.const messageId = useAuiState(state => state.message.id)- const answeredInComposer = useStore(view.$messages).some(- (message, index, all) =>- message.role === 'user' && !message.hidden && index > all.findIndex(candidate => candidate.id === messageId)- )+ const answeredInComposer = answeredAfter(useStore(view.$messages), messageId)const committed = useStore($onboardingAnswers).committed.find(step => step.startsWith('first:'))?.slice(6) ?? nullconst picked = committed ?? (answeredInComposer ? '' : null)diff --git a/apps/desktop/src/lib/chat-messages/parts.ts b/apps/desktop/src/lib/chat-messages/parts.tsindex 997b61a797a..c9390ae1553 100644--- a/apps/desktop/src/lib/chat-messages/parts.ts+++ b/apps/desktop/src/lib/chat-messages/parts.ts@@ -302,3 +302,11 @@ export function appendAssistantTextPart(return next}++/** True when a visible user message follows `messageId` — the reader has moved+ * on, so a question card at `messageId` counts as answered. */+export function answeredAfter(messages: ChatMessage[], messageId: string): boolean {+ const at = messages.findIndex(message => message.id === messageId)++ return at !== -1 && messages.slice(at + 1).some(message => message.role === 'user' && !message.hidden)+}