Skip to content

The agent that grows with you

feat(desktop): one shell for the transcript's inline widgets

Brooklyn Nicholson148cb807713b
diff --git a/apps/desktop/src/components/assistant-ui/artifact-card.tsx b/apps/desktop/src/components/assistant-ui/artifact-card.tsx
index feb9b06c951..e7fb043f6d5 100644
--- a/apps/desktop/src/components/assistant-ui/artifact-card.tsx
+++ b/apps/desktop/src/components/assistant-ui/artifact-card.tsx
@@ -5,6 +5,7 @@ import { useEffect, useMemo } from 'react'
import { useSessionView } from '@/app/chat/session-view'
import { CodeCardIcon } from '@/components/chat/code-card'
+import { WIDGET_SHELL_CLASS } from '@/components/chat/widget-shell'
import { useI18n } from '@/i18n'
import type { ArtifactDetection } from '@/lib/artifact-detect'
import { codiconForLanguage } from '@/lib/markdown-code'
@@ -96,8 +97,9 @@ export function ArtifactCard({ code, detection, streaming = false }: ArtifactCar
return (
<button
className={cn(
- 'group/artifact my-1.5 flex w-full max-w-md items-center gap-2.5 overflow-hidden rounded-[0.625rem] border border-border px-3 py-2.5 text-left transition-colors',
- streaming ? 'cursor-default' : 'cursor-pointer hover:bg-accent/40'
+ WIDGET_SHELL_CLASS,
+ 'group/artifact my-1.5 flex w-full max-w-md items-center gap-2.5 overflow-hidden text-left',
+ streaming ? 'cursor-default' : 'cursor-pointer'
)}
data-slot="aui_artifact-card"
disabled={streaming}
diff --git a/apps/desktop/src/components/assistant-ui/clarify-tool.tsx b/apps/desktop/src/components/assistant-ui/clarify-tool.tsx
index 1c143eb0262..d66e1a4abb0 100644
--- a/apps/desktop/src/components/assistant-ui/clarify-tool.tsx
+++ b/apps/desktop/src/components/assistant-ui/clarify-tool.tsx
@@ -16,6 +16,7 @@ import {
import { requestComposerFocus, requestComposerInsert } from '@/app/chat/composer/focus'
import { useSessionView } from '@/app/chat/session-view'
import { ToolFallback } from '@/components/assistant-ui/tool/fallback'
+import { WIDGET_SHELL_CLASS } from '@/components/chat/widget-shell'
import { Button } from '@/components/ui/button'
import { Kbd } from '@/components/ui/kbd'
import { Textarea } from '@/components/ui/textarea'
@@ -93,7 +94,7 @@ const OPTION_ROW_CLASS =
const CLARIFY_TEXTAREA_CLASS = 'field-sizing-content max-h-40 min-h-0 resize-none'
const CLARIFY_SHELL_CLASS =
- 'my-1.5 rounded-md border border-primary/20 bg-(--ui-chat-surface-background) text-[length:var(--conversation-text-font-size)] text-(--ui-text-primary)'
+ `${WIDGET_SHELL_CLASS} text-[length:var(--conversation-text-font-size)] text-(--ui-text-primary)`
const CLARIFY_ICON_CLASS = 'mt-px size-4 shrink-0 text-(--ui-text-tertiary)'
@@ -237,7 +238,7 @@ function ClarifyToolSettled({ args, result }: ToolCallMessagePartProps) {
)
return (
- <ClarifyShell className="grid gap-1.5 px-2.5 py-2" data-clarify-settled="">
+ <ClarifyShell className="my-1.5 grid gap-1.5" data-clarify-settled="">
{question ? (
<ClarifyLine icon={MessageQuestion}>
<span className="whitespace-pre-wrap font-medium leading-(--conversation-line-height)">{question}</span>
@@ -523,7 +524,7 @@ function ClarifyToolPending({ args }: ToolCallMessagePartProps) {
return (
<ClarifyShell
aria-label={copy.loadingQuestion}
- className="grid min-h-12 place-items-center px-2.5 py-3"
+ className="my-1.5 grid min-h-12 place-items-center"
role="status"
>
<Loader2 aria-hidden className="size-4 animate-spin text-(--ui-text-tertiary)" />
@@ -548,13 +549,22 @@ function ClarifyToolPending({ args }: ToolCallMessagePartProps) {
// exactly those and lets every other printable through to the composer —
// typing a real message instead of picking an option stays possible. The
// value is the choice count so the check needs no store access.
- <ClarifyShell className="grid gap-2 px-2.5 py-2" data-clarify-choices={hasChoices ? choices.length : undefined}>
- <div className="flex items-start gap-2">
- <span className="flex-1 whitespace-pre-wrap font-medium leading-(--conversation-line-height)">{question}</span>
- <MessageQuestion aria-hidden className="mt-px size-4 shrink-0 text-(--ui-text-tertiary)" />
- </div>
+ //
+ // The form is the outer element so the actions can sit OUTSIDE the card and
+ // still submit it — the panel holds the question, the buttons ride below it.
+ <form
+ className="my-1.5 grid gap-4"
+ data-clarify-choices={hasChoices ? choices.length : undefined}
+ onSubmit={handleSubmit}
+ >
+ <ClarifyShell className="grid gap-2">
+ <div className="flex items-start gap-2">
+ <span className="flex-1 whitespace-pre-wrap font-medium leading-(--conversation-line-height)">
+ {question}
+ </span>
+ <MessageQuestion aria-hidden className="mt-px size-4 shrink-0 text-(--ui-text-tertiary)" />
+ </div>
- <form className="grid gap-2" onSubmit={handleSubmit}>
{hasChoices ? (
<div className="grid gap-px" role="group">
{choices.map((choice, index) => (
@@ -616,25 +626,25 @@ function ClarifyToolPending({ args }: ToolCallMessagePartProps) {
value={draft}
/>
)}
+ </ClarifyShell>
- <div className="flex items-center justify-end gap-1">
- <Button disabled={submitting} onClick={() => void respond('')} size="xs" type="button" variant="text">
- {copy.skip}
- </Button>
- <Button disabled={submitting || !pendingAnswer} size="xs" type="submit">
- {submitting ? (
- <Loader2 className="size-3 animate-spin" />
- ) : (
- <>
- {copy.continueLabel}
- <span aria-hidden className="ml-0.5 text-[0.625rem] opacity-70">
- ⏎
- </span>
- </>
- )}
- </Button>
- </div>
- </form>
- </ClarifyShell>
+ <div className="flex items-center justify-end gap-1">
+ <Button disabled={submitting} onClick={() => void respond('')} size="xs" type="button" variant="text">
+ {copy.skip}
+ </Button>
+ <Button disabled={submitting || !pendingAnswer} size="xs" type="submit">
+ {submitting ? (
+ <Loader2 className="size-3 animate-spin" />
+ ) : (
+ <>
+ {copy.continueLabel}
+ <span aria-hidden className="ml-0.5 text-[0.625rem] opacity-70">
+ ⏎
+ </span>
+ </>
+ )}
+ </Button>
+ </div>
+ </form>
)
}
diff --git a/apps/desktop/src/components/chat/widget-shell.ts b/apps/desktop/src/components/chat/widget-shell.ts
new file mode 100644
index 00000000000..eea81bca583
--- /dev/null
+++ b/apps/desktop/src/components/chat/widget-shell.ts
@@ -0,0 +1,12 @@
+/**
+ * Inline transcript widgets — the few tool results that render as a panel the
+ * user reads or acts on (a clarify question, an artifact card) rather than as
+ * a scaffold line.
+ *
+ * They share one shell so they cannot drift apart. They used to each pick their
+ * own: clarify sat on a 2px radius over the chat backdrop's own color (a card
+ * you could only see by its hairline), the artifact card on a hardcoded 10px
+ * over nothing. One radius one rung above the composer, one mode-derived fill,
+ * no border — the surface reads as a surface on the fill alone.
+ */
+export const WIDGET_SHELL_CLASS = 'rounded-3xl bg-(--ui-widget-surface-background) px-3.5 py-3'
diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.css
index 4fea8ed294f..edea88a1713 100644
--- a/apps/desktop/src/styles.css
+++ b/apps/desktop/src/styles.css
@@ -327,6 +327,10 @@
--ui-sidebar-surface-background: var(--ui-bg-sidebar);
--ui-chat-surface-background: var(--ui-bg-chrome);
--ui-editor-surface-background: var(--ui-bg-chrome);
+ /* Inline chat widgets (clarify, artifact card) — the card fill in light
+ mode, nudged down in dark so a widget settles into the transcript
+ instead of glowing above it (see the `.dark` override). */
+ --ui-widget-surface-background: var(--ui-bg-editor);
--ui-chat-bubble-background: color-mix(
in srgb,
var(--theme-bubble-seed) var(--theme-mix-bubble),
@@ -512,6 +516,11 @@
--ui-inline-code-background: color-mix(in srgb, #ffffff 7%, transparent);
--ui-inline-code-foreground: color-mix(in srgb, #ffffff 88%, transparent);
--ui-selection-background: color-mix(in srgb, #ffd24a 38%, transparent);
+ /* A dark card sits ABOVE the chrome (#161618 over #0d0d0e), so an inline
+ widget wearing the raw card fill reads as a lit panel. Take it down a
+ touch — still clearly a surface, no longer the brightest thing in the
+ transcript. Derived from the card so every skin follows its own seed. */
+ --ui-widget-surface-background: color-mix(in srgb, var(--ui-bg-editor) 88%, #000);
}
* {
@@ -1485,7 +1494,7 @@ text-* variant utilities. */ .btn-arc {
}
[data-slot='aui_assistant-message-content'] .aui-md .aui-md-table thead {
- border-bottom-color: var(--dt-border) !important;
+ border-bottom-color: var(--ui-stroke-tertiary) !important;
}
/* Tool / thinking blocks are scaffolding around the model's reply, so we