Skip to content

The agent that grows with you

Typing while a setup or question card waits answers the card; bigger chat text and windows (#129336)

Siddharth Balyane2d0c472ba31
diff --git a/apps/desktop/electron/window-state.ts b/apps/desktop/electron/window-state.ts
index a9f73c7175d..07a78f34ec3 100644
--- a/apps/desktop/electron/window-state.ts
+++ b/apps/desktop/electron/window-state.ts
@@ -100,14 +100,14 @@ interface WorkArea {
// 110% default zoom.
const WINDOW_SIZES: Record<WindowSizeMode, { share: WorkArea; min: WorkArea; max: WorkArea }> = {
normal: {
- share: { width: 0.85, height: 0.85 },
- min: { width: 1220, height: 800 },
- max: { width: 1600, height: 1000 }
+ share: { width: 0.88, height: 0.88 },
+ min: { width: 1280, height: 820 },
+ max: { width: 1760, height: 1100 }
},
onboarding: {
- share: { width: 0.45, height: 0.8 },
- min: { width: 660, height: 700 },
- max: { width: 820, height: 900 }
+ share: { width: 0.5, height: 0.85 },
+ min: { width: 760, height: 760 },
+ max: { width: 960, height: 1000 }
}
}
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.test.tsx b/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.test.tsx
index 89e0e559bc6..8d0cf0c6bb5 100644
--- a/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.test.tsx
+++ b/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.test.tsx
@@ -547,7 +547,7 @@ describe('useComposerSubmit with a clarify parked on the session', () => {
expect(hasOpenServerRequest('req-runtime-session')).toBe(false)
})
- it('skips the question and still sends the typed message on an idle session', async () => {
+ it('answers the question with the typed message on an idle session', async () => {
parkClarify('runtime-session')
const { hook, onSubmit } = renderSubmitHook({ text: 'actually do this instead' })
@@ -555,15 +555,13 @@ describe('useComposerSubmit with a clarify parked on the session', () => {
hook.result.current.submitDraft()
})
- await waitFor(() => expect(respond).toHaveBeenCalledWith({}))
- await waitFor(() =>
- expect(onSubmit).toHaveBeenCalledWith('actually do this instead', expect.objectContaining({ attachments: [] }))
- )
+ await waitFor(() => expect(respond).toHaveBeenCalledWith({ answers: { q0: 'actually do this instead' } }))
+ expect(onSubmit).not.toHaveBeenCalled()
expect($clarifyRequests.get()['runtime-session']).toBeUndefined()
expect(hasOpenServerRequest('req-runtime-session')).toBe(false)
})
- it('skips the question before steering a busy turn', async () => {
+ it('answers the question instead of steering a busy turn', async () => {
parkClarify('runtime-session')
const { hook, onSteer } = renderSubmitHook({ busy: true, text: 'change course' })
@@ -571,8 +569,8 @@ describe('useComposerSubmit with a clarify parked on the session', () => {
hook.result.current.submitDraft()
})
- await waitFor(() => expect(onSteer).toHaveBeenCalledWith('change course'))
- expect(respond).toHaveBeenCalledWith({})
+ await waitFor(() => expect(respond).toHaveBeenCalledWith({ answers: { q0: 'change course' } }))
+ expect(onSteer).not.toHaveBeenCalled()
})
it('leaves the question alone for an empty Enter (Stop, not an answer)', () => {
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts b/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts
index 2304fac0f8a..ae2980277a2 100644
--- a/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts
+++ b/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts
@@ -4,7 +4,7 @@ import { type RefObject, useLayoutEffect, useRef } from 'react'
import { usePaneVisible } from '@/components/pane-shell/pane-visibility'
import { isSideTaskSlashCommand } from '@/lib/desktop-slash-commands'
import { triggerHaptic } from '@/lib/haptics'
-import { hasClarifyRequest, skipClarifyRequest } from '@/store/clarify'
+import { answerClarifyRequest, hasClarifyRequest, skipClarifyRequest } from '@/store/clarify'
import { clearSessionDraft, type ComposerAttachment, isFreshDraftScope } from '@/store/composer'
import { resetBrowseState } from '@/store/composer-input-history'
import { enqueueQueuedPrompt, type QueuedPromptEntry } from '@/store/composer-queue'
@@ -244,24 +244,41 @@ export function useComposerSubmit({
const text = pathifyRefs(draftRef.current)
const payloadPresent = text.trim().length > 0 || attachments.length > 0
- // A clarify card parked on this session owns the turn: the agent is blocked
- // inside its tool batch waiting on `clarify.respond`, so a follow-up routed
- // through steer/queue sits undelivered until the clarify's own timeout
- // (default 5 min) — the message looks sent and nothing happens. Typing a
- // real message instead of picking an option IS the answer "none of these":
- // skip the question so the tool returns, then route the words normally.
+ // A clarify or setup card parked on this session owns the turn: the agent
+ // is blocked inside its tool batch waiting on the card's answer, so a
+ // follow-up routed through steer/queue sits undelivered until the card's
+ // own timeout (default 5 min) — the message looks sent and nothing
+ // happens. Typed words instead of a pick ARE the answer: they go back as
+ // the card's answer, the card settles showing them, and the turn carries
+ // on with no interrupt.
//
- // Fire-and-forget, not awaited: the skip clears the card synchronously and
- // both RPCs ride the same socket in call order, so the gateway resolves the
- // clarify before it sees the follow-up. Awaiting first would leave the draft
- // live for a tick — long enough for a second Enter to send it twice.
+ // A slash command or attachments cannot be an answer: those skip the card
+ // so the tool returns, then route normally. The skip is fire-and-forget:
+ // it clears the card synchronously and both RPCs ride the same socket in
+ // call order, so the gateway resolves the card before it sees the
+ // follow-up.
//
// /btw and /bg run beside the turn (snapshot / separate session) and answer
// neither parked card. With attachments the draft isn't routed as a slash
// command, so it falls back to the ordinary-message behavior.
const isSideQuestion = !attachments.length && isSideTaskSlashCommand(text)
+ const cardParked = payloadPresent && !queueEdit && !isSideQuestion && hasClarifyRequest(sessionId)
+
+ if (
+ cardParked &&
+ !attachments.length &&
+ !SLASH_COMMAND_RE.test(text.trim()) &&
+ answerClarifyRequest(sessionId, text.trim())
+ ) {
+ triggerHaptic('submit')
+ resetBrowseState(sessionId)
+ clearDraft()
+ focusInput()
+
+ return
+ }
- if (payloadPresent && !queueEdit && !isSideQuestion && hasClarifyRequest(sessionId)) {
+ if (cardParked) {
void skipClarifyRequest(sessionId)
}
diff --git a/apps/desktop/src/app/chat/composer/index.tsx b/apps/desktop/src/app/chat/composer/index.tsx
index b76279e03a8..b3ca5ca23d1 100644
--- a/apps/desktop/src/app/chat/composer/index.tsx
+++ b/apps/desktop/src/app/chat/composer/index.tsx
@@ -14,7 +14,7 @@ import {
import { useTourMarker } from '@/app/chat/tour-marker'
import { useHudComposerDrag } from '@/app/hud/composer-drag'
import { composerFloatingStrip, composerInputBacking } from '@/components/chat/composer-dock'
-import { $chatOnboardingSolo, $chatOnboardingThreadIds } from '@/components/onboarding-chat/assembly'
+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'
@@ -218,9 +218,7 @@ export function ChatBar({
// The guide uses the setup profile's inference route; the model pill and
// git controls would expose settings unrelated to its conversational steps.
// Solo covers startup before the guide's session ids are known.
- const onboardingThreadIds = useStore($chatOnboardingThreadIds)
- const chatOnboardingSolo = useStore($chatOnboardingSolo)
- const guidedChat = chatOnboardingSolo || (sessionId != null && onboardingThreadIds.includes(sessionId))
+ const guidedChat = useSetupChatView()
// 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)
diff --git a/apps/desktop/src/app/chat/index.tsx b/apps/desktop/src/app/chat/index.tsx
index f85c3ec1f98..5f0a4c5c099 100644
--- a/apps/desktop/src/app/chat/index.tsx
+++ b/apps/desktop/src/app/chat/index.tsx
@@ -13,6 +13,7 @@ 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 { usePaneGroup, usePaneVisible } from '@/components/pane-shell/pane-visibility'
import { $hoveredTreeGroup, $sessionTileDragging, $sessionTileEdgeHover } from '@/components/pane-shell/tree/store'
import { PromptOverlays } from '@/components/prompt-overlays'
@@ -525,6 +526,7 @@ 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
@@ -805,6 +807,7 @@ const ChatViewContent = memo(function ChatViewContent({
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
diff --git a/apps/desktop/src/components/assistant-ui/ask-directive.tsx b/apps/desktop/src/components/assistant-ui/ask-directive.tsx
index 2f740f7389e..73ded970c9c 100644
--- a/apps/desktop/src/components/assistant-ui/ask-directive.tsx
+++ b/apps/desktop/src/components/assistant-ui/ask-directive.tsx
@@ -51,7 +51,7 @@ export function AskDirective({ attrs, streaming }: { attrs: Record<string, strin
className="my-3 flex min-w-0 max-w-full flex-col gap-2 overflow-visible duration-300 animate-in fade-in-0 slide-in-from-bottom-2"
data-onboarding-card
>
- <div className="text-[13px] font-medium">{question}</div>
+ <div className="text-[length:var(--conversation-text-font-size)] font-medium">{question}</div>
{options.length > 0 && (
<div className="flex min-w-0 max-w-full flex-wrap gap-2">
{options.map(option => (
diff --git a/apps/desktop/src/components/assistant-ui/clarify/core/shell.tsx b/apps/desktop/src/components/assistant-ui/clarify/core/shell.tsx
index 8e611042145..10fd97e9068 100644
--- a/apps/desktop/src/components/assistant-ui/clarify/core/shell.tsx
+++ b/apps/desktop/src/components/assistant-ui/clarify/core/shell.tsx
@@ -3,7 +3,6 @@
import type { ComponentProps } from 'react'
import { WIDGET_SHELL_CLASS } from '@/components/chat/widget-shell'
-import type { MessageQuestion } from '@/lib/icons'
import { cn } from '@/lib/utils'
// field-sizing on top of Textarea's shared chrome; kill min-h-16 for one-liners.
@@ -20,17 +19,3 @@ export function ClarifyShell({ children, className, ...props }: ComponentProps<'
</div>
)
}
-
-export function ClarifyLine({
- children,
- className,
- icon: Icon,
- ...props
-}: ComponentProps<'div'> & { icon: typeof MessageQuestion }) {
- return (
- <div className={cn('flex items-start gap-2', className)} {...props}>
- <div className="min-w-0 flex-1">{children}</div>
- <Icon aria-hidden className={CLARIFY_ICON_CLASS} />
- </div>
- )
-}
diff --git a/apps/desktop/src/components/assistant-ui/clarify/index.tsx b/apps/desktop/src/components/assistant-ui/clarify/index.tsx
index bf668e7666e..e6c03afb72f 100644
--- a/apps/desktop/src/components/assistant-ui/clarify/index.tsx
+++ b/apps/desktop/src/components/assistant-ui/clarify/index.tsx
@@ -6,7 +6,7 @@ import { useMemo, useState } from 'react'
import { useSessionView } from '@/app/chat/session-view'
import { ToolFallback } from '@/components/assistant-ui/tool/fallback'
-import { normalizeSetupChoose, sessionClarifyRequest } from '@/store/clarify'
+import { $settledClarifyResults, normalizeSetupChoose, sessionClarifyRequest } from '@/store/clarify'
import { selectMessageRunning } from '../tool/fallback-model'
import { parseMaybeObject } from '../tool/fallback-model/format'
@@ -27,6 +27,11 @@ export const ClarifyTool = (props: ToolCallMessagePartProps) => {
return <ClarifyToolLive {...props} />
}
+// The request each tool row asked, remembered past its clearing and past a
+// remount (a session switch, a stopped turn): a skip or a typed answer settles
+// it in the store before (or without) `tool.complete`.
+const requestIdByToolCall = new Map<string, string>()
+
function ClarifyToolLive(props: ToolCallMessagePartProps) {
// The tool row is in whichever session's transcript rendered it — read THAT
// session's clarify (primary or tile), not the globally-active one.
@@ -42,7 +47,23 @@ function ClarifyToolLive(props: ToolCallMessagePartProps) {
// settled card. Latch submit so that gap doesn't demote; Stop also clears
// the request and must still collapse an unanswered card.
const [answered, setAnswered] = useState(false)
- const undelivered = useUndeliveredClarify(sessionId, messageRunning && !request && !answered)
+ const settledResults = useStore($settledClarifyResults)
+ const requestId = requestIdByToolCall.get(props.toolCallId)
+ const settledResult = requestId && request?.requestId !== requestId ? settledResults[requestId] : undefined
+
+ if (request && !settledResult && request.requestId !== requestId) {
+ requestIdByToolCall.set(props.toolCallId, request.requestId)
+ }
+
+ const undelivered = useUndeliveredClarify(sessionId, messageRunning && !request && !answered && !settledResult)
+
+ if (settledResult) {
+ return setupCard ? (
+ <SetupChooseSettled {...props} result={settledResult} />
+ ) : (
+ <ClarifyToolSettled {...props} result={settledResult} />
+ )
+ }
// Stopped mid-prompt with no result — don't leave a dead interactive panel.
// `session.info` reports running=false while clarify is blocking, so the
diff --git a/apps/desktop/src/components/assistant-ui/clarify/parse.ts b/apps/desktop/src/components/assistant-ui/clarify/parse.ts
index 2197bd1f52e..b85bf44aa6a 100644
--- a/apps/desktop/src/components/assistant-ui/clarify/parse.ts
+++ b/apps/desktop/src/components/assistant-ui/clarify/parse.ts
@@ -49,13 +49,15 @@ export interface ClarifyResponse {
}
/** Parse clarify tool JSON (`responses` array). */
-export function readClarifyResult(result: unknown): { responses: ClarifyResponse[] } {
+export function readClarifyResult(result: unknown): { outcome?: string; responses: ClarifyResponse[] } {
const row = parseMaybeObject(result)
if (!Array.isArray(row.responses)) {
return { responses: [] }
}
+ const outcome = typeof row.outcome === 'string' ? row.outcome : undefined
+
const responses = row.responses.map((entry): ClarifyResponse => {
const item = parseMaybeObject(entry)
const answer = item.user_response
@@ -67,5 +69,5 @@ export function readClarifyResult(result: unknown): { responses: ClarifyResponse
}
})
- return { responses }
+ return { outcome, responses }
}
diff --git a/apps/desktop/src/components/assistant-ui/clarify/pending.tsx b/apps/desktop/src/components/assistant-ui/clarify/pending.tsx
index 1985f31b66f..86778c1c369 100644
--- a/apps/desktop/src/components/assistant-ui/clarify/pending.tsx
+++ b/apps/desktop/src/components/assistant-ui/clarify/pending.tsx
@@ -7,11 +7,17 @@ import { Loader } from '@/components/ui/loader'
import { useI18n } from '@/i18n'
import { triggerHaptic } from '@/lib/haptics'
import { MessageQuestion } from '@/lib/icons'
-import { bareChoice, type ClarifyQuestion, type ClarifyRequest, clearClarifyRequest } from '@/store/clarify'
+import {
+ bareChoice,
+ type ClarifyQuestion,
+ type ClarifyRequest,
+ clearClarifyRequest,
+ skipClarify
+} from '@/store/clarify'
import { $gateway } from '@/store/gateway'
import { reconnectAction } from '@/store/gateway-reconnect'
import { notifyError } from '@/store/notifications'
-import { forgetServerRequest, respondToServerRequest } from '@/store/server-requests'
+import { forgetServerRequest } from '@/store/server-requests'
import { requestForOwnedSession } from '@/store/session-states'
import { ClarifyConfirmBar } from './core/confirm-bar'
@@ -221,10 +227,8 @@ export function ClarifyToolPending({
}
onAnswered()
- clearClarifyRequest(request.requestId, request.sessionId)
-
// A response with no `answers` is the cancel-all (the plain Esc path).
- respondToServerRequest(request.requestId, {})
+ skipClarify(request)
}, [onAnswered, request])
const handleSubmit = useCallback(
diff --git a/apps/desktop/src/components/assistant-ui/clarify/settled.tsx b/apps/desktop/src/components/assistant-ui/clarify/settled.tsx
index e076570d226..b4253f1b7c1 100644
--- a/apps/desktop/src/components/assistant-ui/clarify/settled.tsx
+++ b/apps/desktop/src/components/assistant-ui/clarify/settled.tsx
@@ -4,17 +4,19 @@ import type { ToolCallMessagePartProps } from '@assistant-ui/react'
import { ToolFallback } from '@/components/assistant-ui/tool/fallback'
import { useI18n } from '@/i18n'
-import { CircleLetterA, MessageQuestion } from '@/lib/icons'
import { cn } from '@/lib/utils'
-import { ClarifyLine, ClarifyShell } from './core/shell'
+import { ClarifyShell } from './core/shell'
import { readClarifyResult } from './parse'
/** Settled batch card: every question with its locked (or absent) answer. */
export function ClarifyToolSettled(props: ToolCallMessagePartProps) {
const { t } = useI18n()
const copy = t.assistant.clarify
- const { responses } = readClarifyResult(props.result)
+ const { outcome, responses } = readClarifyResult(props.result)
+ // Skip (the card's or the composer's) and a stopped turn both end the batch
+ // as `cancelled`: the user chose not to answer, so it reads as skipped.
+ const cancelled = outcome === 'cancelled'
if (responses.length === 0) {
return <ToolFallback {...props} />
@@ -29,23 +31,19 @@ export function ClarifyToolSettled(props: ToolCallMessagePartProps) {
return (
<div className="grid gap-1" key={`${index}-${row.question ?? ''}`}>
{row.question ? (
- <ClarifyLine icon={MessageQuestion}>
- <span className="whitespace-pre-wrap font-medium leading-(--conversation-line-height)">
- {row.question}
- </span>
- </ClarifyLine>
+ <span className="whitespace-pre-wrap font-medium leading-(--conversation-line-height)">
+ {row.question}
+ </span>
) : null}
- <ClarifyLine icon={CircleLetterA}>
- <p
- className={cn(
- 'whitespace-pre-wrap leading-(--conversation-line-height)',
- blank ? 'italic text-(--ui-text-tertiary)' : 'text-(--ui-text-secondary)'
- )}
- data-clarify-answer=""
- >
- {blank ? (row.unanswered ? copy.noAnswer : copy.skipped) : answer}
- </p>
- </ClarifyLine>
+ <p
+ className={cn(
+ 'whitespace-pre-wrap leading-(--conversation-line-height)',
+ blank ? 'italic text-(--ui-text-tertiary)' : 'text-(--ui-text-secondary)'
+ )}
+ data-clarify-answer=""
+ >
+ {blank ? (row.unanswered && !cancelled ? copy.noAnswer : copy.skipped) : answer}
+ </p>
</div>
)
})}
diff --git a/apps/desktop/src/components/assistant-ui/clarify/setup-pending.tsx b/apps/desktop/src/components/assistant-ui/clarify/setup-pending.tsx
index 621473e08f5..b6b060a9b7a 100644
--- a/apps/desktop/src/components/assistant-ui/clarify/setup-pending.tsx
+++ b/apps/desktop/src/components/assistant-ui/clarify/setup-pending.tsx
@@ -18,6 +18,7 @@ import {
EMPTY_SETUP_STAGE,
SETUP_CHOOSE_QID,
setupChooseStage,
+ skipClarify,
stageSetupChoose
} from '@/store/clarify'
import { notifyError } from '@/store/notifications'
@@ -161,8 +162,7 @@ export function SetupChoosePending({
}
onAnswered()
- clearClarifyRequest(request.requestId, request.sessionId)
- respondToServerRequest(request.requestId, {})
+ skipClarify(request)
}, [onAnswered, request])
const handleSubmit = useCallback(
diff --git a/apps/desktop/src/components/assistant-ui/clarify/setup-settled.tsx b/apps/desktop/src/components/assistant-ui/clarify/setup-settled.tsx
index 58bf76988e6..693b6501456 100644
--- a/apps/desktop/src/components/assistant-ui/clarify/setup-settled.tsx
+++ b/apps/desktop/src/components/assistant-ui/clarify/setup-settled.tsx
@@ -6,13 +6,12 @@ import { useStore } from '@nanostores/react'
import { useSessionView } from '@/app/chat/session-view'
import { ToolFallback } from '@/components/assistant-ui/tool/fallback'
import { useI18n } from '@/i18n'
-import { CircleLetterA, MessageQuestion } from '@/lib/icons'
import { cn } from '@/lib/utils'
import { normalizeSetupChoose } from '@/store/clarify'
import { parseMaybeObject } from '../tool/fallback-model/format'
-import { ClarifyLine, ClarifyShell } from './core/shell'
+import { ClarifyShell } from './core/shell'
import { useSetupLabel } from './setup-rows'
const OUTCOMES = new Set(['cancelled', 'no_answer', 'submitted'])
@@ -48,21 +47,17 @@ export function SetupChooseSettled(props: ToolCallMessagePartProps) {
return (
<ClarifyShell className="my-1.5 grid gap-1" data-clarify-settled="">
{question ? (
- <ClarifyLine icon={MessageQuestion}>
- <span className="whitespace-pre-wrap font-medium leading-(--conversation-line-height)">{question}</span>
- </ClarifyLine>
+ <span className="whitespace-pre-wrap font-medium leading-(--conversation-line-height)">{question}</span>
) : null}
- <ClarifyLine icon={CircleLetterA}>
- <p
- className={cn(
- 'whitespace-pre-wrap leading-(--conversation-line-height)',
- answer ? 'text-(--ui-text-secondary)' : 'italic text-(--ui-text-tertiary)'
- )}
- data-clarify-answer=""
- >
- {answer || (result.outcome === 'no_answer' ? copy.noAnswer : copy.skipped)}
- </p>
- </ClarifyLine>
+ <p
+ className={cn(
+ 'whitespace-pre-wrap leading-(--conversation-line-height)',
+ answer ? 'text-(--ui-text-secondary)' : 'italic text-(--ui-text-tertiary)'
+ )}
+ data-clarify-answer=""
+ >
+ {answer || (result.outcome === 'no_answer' ? copy.noAnswer : copy.skipped)}
+ </p>
</ClarifyShell>
)
}
diff --git a/apps/desktop/src/components/assistant-ui/markdown-table.tsx b/apps/desktop/src/components/assistant-ui/markdown-table.tsx
index 1fcec60002e..062ef588a01 100644
--- a/apps/desktop/src/components/assistant-ui/markdown-table.tsx
+++ b/apps/desktop/src/components/assistant-ui/markdown-table.tsx
@@ -157,7 +157,7 @@ export function ResizableMarkdownTable({ children, className, ...props }: Compon
<div className="aui-md-table my-2 max-w-full overflow-x-auto rounded-[0.375rem] border border-(--ui-stroke-tertiary)">
<table
className={cn(
- 'm-0 w-full min-w-[18rem] border-collapse text-[0.8125rem] [&_tr]:border-b [&_tr]:border-(--ui-stroke-tertiary) last:[&_tr]:border-0',
+ 'm-0 w-full min-w-[18rem] border-collapse text-[length:var(--conversation-text-font-size)] [&_tr]:border-b [&_tr]:border-(--ui-stroke-tertiary) last:[&_tr]:border-0',
widths && 'table-fixed [&_td]:wrap-anywhere',
className
)}
@@ -183,7 +183,7 @@ export function ResizableMarkdownTh({ children, className, ...props }: Component
return (
<th
className={cn(
- 'relative px-2.5 py-1.5 text-left align-middle text-[0.75rem] font-medium text-muted-foreground',
+ 'relative px-2.5 py-1.5 text-left align-middle text-[length:var(--conversation-caption-font-size)] font-medium text-muted-foreground',
// The trailing column has no seam: its right edge is the table's edge,
// and there is nothing on the far side to trade width with.
'[&:last-child_[data-md-col-handle]]:hidden',
diff --git a/apps/desktop/src/components/assistant-ui/markdown-text.tsx b/apps/desktop/src/components/assistant-ui/markdown-text.tsx
index b7092976629..70f30cf0888 100644
--- a/apps/desktop/src/components/assistant-ui/markdown-text.tsx
+++ b/apps/desktop/src/components/assistant-ui/markdown-text.tsx
@@ -516,13 +516,14 @@ interface MarkdownTextSurfaceProps {
textDirection?: 'ltr' | 'rtl'
}
-// Headings shrink to chat scale rather than the prose default (h1≈xl). Kept
+// Headings shrink to chat scale rather than the prose default (h1≈xl). In em,
+// so they step up from the body text wherever its token sits. Kept
// table-driven so adding/tweaking levels is one row.
const HEADING_SIZES: Record<'h1' | 'h2' | 'h3' | 'h4', string> = {
- h1: 'text-[1rem] tracking-tight',
- h2: 'text-[0.9375rem] tracking-tight',
- h3: 'text-[0.875rem]',
- h4: 'text-[0.8125rem]'
+ h1: 'text-[1.25em] tracking-tight',
+ h2: 'text-[1.15em] tracking-tight',
+ h3: 'text-[1.075em]',
+ h4: 'text-[1em]'
}
const MARKDOWN_CONTAINER_CLASS_NAME = cn(
@@ -737,7 +738,7 @@ function MarkdownTextSurface({
),
th: ResizableMarkdownTh,
td: ({ children, className, ...props }: ComponentProps<'td'>) => (
- <td className={cn('px-2.5 py-1.5 align-top text-[0.8125rem] leading-snug', className)} {...props}>
+ <td className={cn('px-2.5 py-1.5 align-top leading-snug', className)} {...props}>
{decorateText ? decorateText(children) : children}
</td>
),
diff --git a/apps/desktop/src/components/onboarding-chat/assembly.ts b/apps/desktop/src/components/onboarding-chat/assembly.ts
index 15b918679ea..8dd0fac4148 100644
--- a/apps/desktop/src/components/onboarding-chat/assembly.ts
+++ b/apps/desktop/src/components/onboarding-chat/assembly.ts
@@ -1,6 +1,7 @@
import { useStore } from '@nanostores/react'
import { atom } from 'nanostores'
+import { useSessionView } from '@/app/chat/session-view'
import { allPaneIds, group, type LayoutNode } from '@/components/pane-shell/tree/model'
import { applyLayoutPreset } from '@/components/pane-shell/tree/presets'
import {
@@ -17,6 +18,7 @@ import {
import { registry } from '@/contrib/registry'
import { runtimeTranslations } from '@/i18n/runtime'
import { isOnboardingEnabled } from '@/lib/onboarding-enabled'
+import { useStoreSelector } from '@/lib/use-session-slice'
import { $interfaceMode, type InterfaceMode, setInterfaceMode } from '@/store/interface-mode'
import { setSidebarOpen } from '@/store/layout'
import { loadMachineProfile, machineUserName } from '@/store/machine'
@@ -208,3 +210,18 @@ export function useOnboardingChatActive(): boolean {
solo || (runtimeId != null && threadIds.includes(runtimeId)) || (storedId != null && threadIds.includes(storedId))
)
}
+
+/** Whether the chat view this renders in (primary or a tile) shows the setup
+ * chat. Solo covers the primary view before the guide's session ids are known. */
+export function useSetupChatView(): boolean {
+ const view = useSessionView()
+ const solo = useStore($chatOnboardingSolo)
+ 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) || inThread
+}
diff --git a/apps/desktop/src/store/clarify.ts b/apps/desktop/src/store/clarify.ts
index c401ccb8be8..720b0348a7f 100644
--- a/apps/desktop/src/store/clarify.ts
+++ b/apps/desktop/src/store/clarify.ts
@@ -164,6 +164,29 @@ export const sessionClarifyRequest = (sessionId: string | null) =>
export function setClarifyRequest(request: ClarifyRequest): void {
$clarifyRequests.set({ ...$clarifyRequests.get(), [keyFor(request.sessionId)]: request })
+ forgetSettledClarify(request.requestId)
+}
+
+/**
+ * Tool results the renderer already knows for requests it answered, keyed by
+ * request id. The card settles from this the moment it is answered, so a skip
+ * or a typed answer never falls back to a bare tool row when the tool's own
+ * `tool.complete` is late or never lands (a stopped turn).
+ */
+export const $settledClarifyResults = atom<Record<string, Record<string, unknown>>>({})
+
+function forgetSettledClarify(requestId: string): void {
+ const settled = $settledClarifyResults.get()
+
+ if (requestId in settled) {
+ const next = { ...settled }
+ delete next[requestId]
+ $settledClarifyResults.set(next)
+ }
+}
+
+function settleClarify(request: ClarifyRequest, result: Record<string, unknown>): void {
+ $settledClarifyResults.set({ ...$settledClarifyResults.get(), [request.requestId]: result })
}
export function clearClarifyRequest(requestId?: string, sessionId?: string | null): void {
@@ -253,12 +276,32 @@ export function clearSettledClarifyRequest(sessionId: string | null): void {
}
/**
- * The composer uses this when the user types a real message instead of picking
- * an option: a clarify blocks the agent inside its tool batch, so leaving it
- * unanswered would park the follow-up until the server-side clarify timeout
- * — the message looks sent and nothing happens. Skipping lets
- * the tool return and the turn carry on with the user's actual words.
+ * Skip a parked card: clear it, answer its request with no pick, and settle it
+ * as skipped. The card's Skip button uses this, and so does the composer for a
+ * message that cannot be an answer (a slash command, attachments).
*/
+export function skipClarify(request: ClarifyRequest): void {
+ // Clear first: the answer is already decided, and an in-flight RPC must not
+ // leave a live card the user can answer a second time.
+ clearClarifyRequest(request.requestId, request.sessionId)
+
+ respondToServerRequest(request.requestId, {})
+
+ settleClarify(
+ request,
+ request.setup
+ ? { outcome: 'cancelled', picked: null }
+ : {
+ outcome: 'cancelled',
+ responses: request.questions.map(question => ({
+ question: question.question,
+ status: 'unanswered',
+ user_response: null
+ }))
+ }
+ )
+}
+
export async function skipClarifyRequest(sessionId: string | null | undefined): Promise<boolean> {
const request = $clarifyRequests.get()[keyFor(sessionId)]
@@ -266,11 +309,90 @@ export async function skipClarifyRequest(sessionId: string | null | undefined):
return false
}
- // Clear first: the answer is already decided, and an in-flight RPC must not
- // leave a live card the user can answer a second time.
- clearClarifyRequest(request.requestId, request.sessionId)
+ skipClarify(request)
- respondToServerRequest(request.requestId, {})
+ return true
+}
+
+/**
+ * Answer the card parked on `sessionId` with text the user typed in the
+ * composer. A card blocks the agent inside its tool batch, so the typed words
+ * ARE the answer: the tool returns them and the turn carries on, with no
+ * interrupt. A batch takes the text as its first open question's answer. False when
+ * no card is parked or its request is gone; the caller then sends the words as
+ * an ordinary message.
+ */
+export function answerClarifyRequest(sessionId: string | null | undefined, text: string): boolean {
+ const request = $clarifyRequests.get()[keyFor(sessionId)]
+
+ if (!request) {
+ return false
+ }
+
+ if (request.setup) {
+ // A multi-select picker keeps the rows already staged on the card, the
+ // same as its own Confirm: the typed words are one more pick.
+ const picked = request.setup.multiSelect ? [...setupChooseStage(request.requestId).picked, text] : text
+
+ if (!respondToServerRequest(request.requestId, { picked })) {
+ return false
+ }
+
+ if (request.setup.multiSelect) {
+ commitSetupChoose(request.requestId)
+ }
+
+ clearClarifyRequest(request.requestId, request.sessionId)
+ settleClarify(request, { outcome: 'submitted', picked })
+
+ return true
+ }
+
+ // A reconnect replay can arrive with answers already locked server-side;
+ // the backend merges this response over them, so the typed text goes to
+ // the first question still open and the locks stand.
+ const locked = request.lockedAnswers ?? {}
+ const target = request.questions.find(question => !(question.qid in locked)) ?? request.questions[0]
+ const answers = { [target.qid]: target.multiSelect ? JSON.stringify([text]) : text }
+
+ if (!respondToServerRequest(request.requestId, { answers })) {
+ return false
+ }
+
+ clearClarifyRequest(request.requestId, request.sessionId)
+ settleClarify(request, {
+ outcome: 'submitted',
+ responses: request.questions.map(question => settledResponse(question, { ...locked, ...answers }))
+ })
return true
}
+
+/** One row of a clarify result, shaped like `tools/clarify_tool.py::_result`. */
+function settledResponse(question: ClarifyQuestion, answers: Record<string, null | string>) {
+ const raw = answers[question.qid]
+
+ if (!raw) {
+ return {
+ question: question.question,
+ status: question.qid in answers ? 'skipped' : 'unanswered',
+ user_response: null
+ }
+ }
+
+ let answer: string | string[] = raw
+
+ if (question.multiSelect) {
+ try {
+ const parsed: unknown = JSON.parse(raw)
+
+ if (Array.isArray(parsed)) {
+ answer = parsed.map(String)
+ }
+ } catch {
+ // A non-JSON multi-select answer stays one value.
+ }
+ }
+
+ return { question: question.question, status: 'answered', user_response: answer }
+}
diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.css
index 9c9a3a89b73..65ae6b61b52 100644
--- a/apps/desktop/src/styles.css
+++ b/apps/desktop/src/styles.css
@@ -508,7 +508,7 @@
--composer-shell-pad-block-end: 0.625rem;
--message-text-indent: 0.75rem;
- --conversation-text-font-size: 0.8125rem;
+ --conversation-text-font-size: 0.875rem;
--conversation-tool-font-size: 0.6875rem;
--conversation-caption-font-size: 0.75rem;
--conversation-line-height: 1.125rem;
@@ -1108,6 +1108,15 @@
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. */
+[data-setup-chat] {
+ --conversation-text-font-size: 0.9375rem;
+ --conversation-tool-font-size: 0.75rem;
+ --conversation-caption-font-size: 0.8125rem;
+ --conversation-line-height: 1.375rem;
+}
+
@keyframes arc-border {
/* Compositor-only travel. The ::before layer is 300% × 300% of the host
(mirroring the old `background-size: 300%`), so translating it from
@@ -2004,7 +2013,7 @@ body.guest-pointer-lock :is(webview, iframe) {
[data-slot='composer-rich-input'] {
color: var(--ui-text-primary);
- font-size: 0.8125rem;
+ font-size: var(--conversation-text-font-size);
}
[data-slot='composer-rich-input']:is(:empty, [data-empty])::before {