Skip to content

AI-native design editor. Open-source Figma alternative.

feat(ai): refine tool change and run views (#858)

Danila Poyarkov00da4678ad14
diff --git a/CHANGELOG.md b/CHANGELOG.md
index baaed9dd7..b266e90a7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -46,8 +46,8 @@
- Hide, lock, and constrain layers in design JSX with `visible={false}`, `locked`, and `constraints={{ horizontal, vertical }}`, set italic text with `italic`, and describe strokes fully with `strokes`, `strokeWeights`, `strokeCap`, `strokeJoin`, and the node-level `dashPattern`. JSX export now writes these together with stacked, gradient, and image fills, every effect, absolutely positioned children, size limits, vertical text alignment, masks, and variable bindings, so rendering exported JSX reproduces them and `diff_jsx` reports changes to them.
- Jump between pages from the command palette: it lists the pages you visited recently in the tab, **Go to page…** lists every page, and typing a page name finds it.
- Choose how much an AI model thinks for each message from the chat composer, from Off to Extra high or the provider default. Anthropic, Google, DeepSeek, OpenAI, OpenRouter, and compatible models apply it, where reasoning effort previously reached only OpenAI and OpenRouter models. A model profile's thinking level, which replaces its free-text reasoning effort, sets the starting choice, and finished reasoning shows how long the model thought.
-- Read AI tool calls at a glance: each call shows a one-line summary and buttons that bring the layers it touched into view, even on another page. Expanded, it shows highlighted JSX, scripts, and JSON input and output, and exported images inline. A render call's JSX streams in as the model writes it, and a long run folds its earlier steps into one row.
-- Review what each AI edit changed from its tool call in the chat: a before and after image with a comparison slider or highlighted changed pixels, and a diff of the layers' JSX. Both are saved with the conversation. Settings → Chat → Change previews sets the image size (240, 480, or 960 px) or turns images off to keep only the JSX diff. The chat AI can check its own work the same way with `diff_changes`, which compares the page or a layer with its state before the run edited it as a patch that `diff_apply` can replay.
+- Read AI tool calls at a glance: each call shows a one-line summary and buttons that bring the layers it touched into view, even on another page. Expanded, it shows highlighted JSX, scripts, and JSON input and output, and exported images inline. A render call's JSX streams in as the model writes it, and a long run folds its earlier steps into one row that lists them by name and counts failures.
+- Review what each AI edit changed from its tool call in the chat: a before and after image split by a draggable divider, or the changed pixels highlighted, and a diff of the layers' JSX. Both are saved with the conversation. Settings → Chat → Change previews sets the image size (240, 480, or 960 px) or turns images off to keep only the JSX diff. The chat AI can check its own work the same way with `diff_changes`, which compares the page or a layer with its state before the run edited it as a patch that `diff_apply` can replay.
- Revert an AI reply's edits from the chat while nothing has been edited since, regenerate the last reply, or edit the last message and send it again; regenerating and resending undo the replaced reply's edits first when they can. A reverted reply stays in the chat marked *Changes reverted*, also after reopening the conversation, and your next message tells the AI that those edits are gone, so it does not build on them; **Restore changes** on the reply, or Edit → Redo, brings the edits back and removes the mark while nothing has been edited since.
- Preview designs progressively on the canvas as direct AI providers stream JSX, without saving partial designs or adding intermediate undo steps. A preview stays with its page: it hides while you view another page and returns when you come back.
- Write design trees as TSX with `@open-pencil/design-jsx` as the JSX import source, and render them with `renderTree`.
diff --git a/packages/vue/src/i18n/locales/de/ai.json b/packages/vue/src/i18n/locales/de/ai.json
index 665b0cec8..ce4aa661d 100644
--- a/packages/vue/src/i18n/locales/de/ai.json
+++ b/packages/vue/src/i18n/locales/de/ai.json
@@ -49,8 +49,6 @@
"toolStepsFailed": "fehlgeschlagen: {count}",
"showNodeOnCanvas": "{name} auf der Arbeitsfläche zeigen",
"toolChanges": "Änderungen",
- "changeView": "Änderungsansicht",
- "changeCompare": "Vergleichen",
"changeHighlight": "Hervorheben",
"changeBefore": "Vorher",
"changeAfter": "Nachher",
diff --git a/packages/vue/src/i18n/locales/es/ai.json b/packages/vue/src/i18n/locales/es/ai.json
index 1b644bb80..8748e025c 100644
--- a/packages/vue/src/i18n/locales/es/ai.json
+++ b/packages/vue/src/i18n/locales/es/ai.json
@@ -49,8 +49,6 @@
"toolStepsFailed": "con errores: {count}",
"showNodeOnCanvas": "Mostrar {name} en el lienzo",
"toolChanges": "Cambios",
- "changeView": "Vista de cambios",
- "changeCompare": "Comparar",
"changeHighlight": "Resaltar",
"changeBefore": "Antes",
"changeAfter": "Después",
diff --git a/packages/vue/src/i18n/locales/fr/ai.json b/packages/vue/src/i18n/locales/fr/ai.json
index 164f85b02..aa3a8f87a 100644
--- a/packages/vue/src/i18n/locales/fr/ai.json
+++ b/packages/vue/src/i18n/locales/fr/ai.json
@@ -49,8 +49,6 @@
"toolStepsFailed": "en échec : {count}",
"showNodeOnCanvas": "Afficher {name} sur le canevas",
"toolChanges": "Modifications",
- "changeView": "Vue des modifications",
- "changeCompare": "Comparer",
"changeHighlight": "Surligner",
"changeBefore": "Avant",
"changeAfter": "Après",
diff --git a/packages/vue/src/i18n/locales/it/ai.json b/packages/vue/src/i18n/locales/it/ai.json
index 4e2514768..eb6accdad 100644
--- a/packages/vue/src/i18n/locales/it/ai.json
+++ b/packages/vue/src/i18n/locales/it/ai.json
@@ -49,8 +49,6 @@
"toolStepsFailed": "non riusciti: {count}",
"showNodeOnCanvas": "Mostra {name} nella tela",
"toolChanges": "Modifiche",
- "changeView": "Vista delle modifiche",
- "changeCompare": "Confronta",
"changeHighlight": "Evidenzia",
"changeBefore": "Prima",
"changeAfter": "Dopo",
diff --git a/packages/vue/src/i18n/locales/ja/ai.json b/packages/vue/src/i18n/locales/ja/ai.json
index 848bee28a..d4153b130 100644
--- a/packages/vue/src/i18n/locales/ja/ai.json
+++ b/packages/vue/src/i18n/locales/ja/ai.json
@@ -49,8 +49,6 @@
"toolStepsFailed": "失敗: {count}",
"showNodeOnCanvas": "{name} をキャンバスに表示",
"toolChanges": "変更",
- "changeView": "変更の表示",
- "changeCompare": "比較",
"changeHighlight": "ハイライト",
"changeBefore": "変更前",
"changeAfter": "変更後",
diff --git a/packages/vue/src/i18n/locales/pl/ai.json b/packages/vue/src/i18n/locales/pl/ai.json
index 5f4701227..059cb205a 100644
--- a/packages/vue/src/i18n/locales/pl/ai.json
+++ b/packages/vue/src/i18n/locales/pl/ai.json
@@ -49,8 +49,6 @@
"toolStepsFailed": "nieudane: {count}",
"showNodeOnCanvas": "Pokaż {name} na kanwie",
"toolChanges": "Zmiany",
- "changeView": "Widok zmian",
- "changeCompare": "Porównaj",
"changeHighlight": "Wyróżnij",
"changeBefore": "Przed",
"changeAfter": "Po",
diff --git a/packages/vue/src/i18n/locales/ru/ai.json b/packages/vue/src/i18n/locales/ru/ai.json
index c67f68039..e34c2ba1a 100644
--- a/packages/vue/src/i18n/locales/ru/ai.json
+++ b/packages/vue/src/i18n/locales/ru/ai.json
@@ -49,8 +49,6 @@
"toolStepsFailed": "с ошибкой: {count}",
"showNodeOnCanvas": "Показать {name} на холсте",
"toolChanges": "Изменения",
- "changeView": "Вид изменений",
- "changeCompare": "Сравнить",
"changeHighlight": "Подсветить",
"changeBefore": "До",
"changeAfter": "После",
diff --git a/packages/vue/src/i18n/locales/zh-cn/ai.json b/packages/vue/src/i18n/locales/zh-cn/ai.json
index 96b8819bc..a6946a270 100644
--- a/packages/vue/src/i18n/locales/zh-cn/ai.json
+++ b/packages/vue/src/i18n/locales/zh-cn/ai.json
@@ -49,8 +49,6 @@
"toolStepsFailed": "失败:{count}",
"showNodeOnCanvas": "在画布上显示 {name}",
"toolChanges": "更改",
- "changeView": "更改视图",
- "changeCompare": "对比",
"changeHighlight": "高亮",
"changeBefore": "之前",
"changeAfter": "之后",
diff --git a/packages/vue/src/i18n/messages/ai.ts b/packages/vue/src/i18n/messages/ai.ts
index db25d82d1..0d885d7af 100644
--- a/packages/vue/src/i18n/messages/ai.ts
+++ b/packages/vue/src/i18n/messages/ai.ts
@@ -93,8 +93,6 @@ export const aiMessageDefaults = {
toolStepsFailed: params('failed: {count}'),
showNodeOnCanvas: params('Show {name} on canvas'),
toolChanges: 'Changes',
- changeView: 'Change view',
- changeCompare: 'Compare',
changeHighlight: 'Highlight',
changeBefore: 'Before',
changeAfter: 'After',
diff --git a/src/components/chat/tool/ToolCallCard.vue b/src/components/chat/tool/ToolCallCard.vue
index 8e541941d..ac1ede341 100644
--- a/src/components/chat/tool/ToolCallCard.vue
+++ b/src/components/chat/tool/ToolCallCard.vue
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { CollapsibleContent, CollapsibleRoot, CollapsibleTrigger } from 'reka-ui'
-import { computed, defineAsyncComponent, ref } from 'vue'
+import { computed, ref } from 'vue'
import { useI18n } from '@open-pencil/vue'
@@ -19,14 +19,13 @@ import { readToolChange } from '@/app/ai/tools/changes/store'
import { toolCallState } from '@/components/chat/tool/state'
import ToolChangeView from '@/components/chat/tool/ToolChangeView.vue'
import ToolNodeChips from '@/components/chat/tool/ToolNodeChips.vue'
+import { loadCodeViewer } from '@/components/code-editor/lazy'
+import CodeViewer from '@/components/code-editor/LazyCodeViewer.vue'
import AppAlert from '@/components/ui/feedback/AppAlert.vue'
import SegmentedControl from '@/components/ui/select/SegmentedControl.vue'
import { chatToolTheme } from '@/theme/chat/tool'
import { collapsibleContentMotion } from '@/theme/collapsible/collapsible'
-// CodeMirror loads with the first expanded call, not with the chat panel.
-const CodeViewer = defineAsyncComponent(() => import('@/components/code-editor/CodeViewer.vue'))
-
const { part } = defineProps<{ part: ToolCallPart }>()
const { ai } = useI18n()
const ui = chatToolTheme()
@@ -81,7 +80,13 @@ function json(value: unknown): string {
<template>
<CollapsibleRoot :class="ui.root()" :data-tool-state="state" data-slot="chat-tool-call">
- <CollapsibleTrigger :class="ui.trigger()" :disabled="!expandable">
+ <!-- Start loading CodeMirror on hover, so it is ready by the time the call opens. -->
+ <CollapsibleTrigger
+ :class="ui.trigger()"
+ :disabled="!expandable"
+ @pointerenter="loadCodeViewer"
+ @focus="loadCodeViewer"
+ >
<span :class="ui.status()" :data-state="state" :aria-label="stateLabel" role="img">
<icon-lucide-loader-circle
v-if="state === 'pending'"
diff --git a/src/components/chat/tool/ToolCallGroup.vue b/src/components/chat/tool/ToolCallGroup.vue
index 89c9030ff..5652ccb2a 100644
--- a/src/components/chat/tool/ToolCallGroup.vue
+++ b/src/components/chat/tool/ToolCallGroup.vue
@@ -4,9 +4,10 @@ import { computed } from 'vue'
import { useI18n } from '@open-pencil/vue'
-import type { ToolCallPart } from '@/app/ai/chat/tool-calls/display'
+import { toolDisplayName, type ToolCallPart } from '@/app/ai/chat/tool-calls/display'
import { toolCallState } from '@/components/chat/tool/state'
import ToolCallCard from '@/components/chat/tool/ToolCallCard.vue'
+import AppBadge from '@/components/ui/feedback/AppBadge.vue'
import { chatToolTheme } from '@/theme/chat/tool'
import { collapsibleContentMotion } from '@/theme/collapsible/collapsible'
@@ -22,6 +23,8 @@ const latest = computed(() => parts.at(-1))
const failed = computed(
() => earlier.value.filter((part) => toolCallState(part) === 'error').length
)
+/** The earlier steps by name, one line that truncates; the badges carry the counts. */
+const names = computed(() => earlier.value.map(toolDisplayName).join(' · '))
const label = computed(() => {
const steps = ai.value.toolSteps({ count: earlier.value.length })
return failed.value ? `${steps} · ${ai.value.toolStepsFailed({ count: failed.value })}` : steps
@@ -34,9 +37,13 @@ const label = computed(() => {
</div>
<div v-else class="space-y-1.5">
<CollapsibleRoot :class="ui.group()" data-slot="chat-tool-group">
- <CollapsibleTrigger :class="ui.groupTrigger()">
+ <CollapsibleTrigger :class="ui.groupTrigger()" :aria-label="label">
<icon-lucide-list-checks :class="ui.groupIcon()" aria-hidden="true" />
- <span class="flex-1">{{ label }}</span>
+ <span :class="ui.groupNames()" aria-hidden="true">{{ names }}</span>
+ <AppBadge v-if="failed" :ui="{ base: ui.groupFailed() }" aria-hidden="true">
+ {{ ai.toolStepsFailed({ count: failed }) }}
+ </AppBadge>
+ <AppBadge aria-hidden="true">{{ earlier.length }}</AppBadge>
<icon-lucide-chevron-down :class="ui.chevron()" aria-hidden="true" />
</CollapsibleTrigger>
<CollapsibleContent :class="collapsibleContentMotion">
diff --git a/src/components/chat/tool/ToolChangeView.vue b/src/components/chat/tool/ToolChangeView.vue
index 445b861fe..fe4414f86 100644
--- a/src/components/chat/tool/ToolChangeView.vue
+++ b/src/components/chat/tool/ToolChangeView.vue
@@ -1,30 +1,28 @@
<script setup lang="ts">
import { useObjectUrl } from '@vueuse/core'
-import { computed, defineAsyncComponent, ref } from 'vue'
+import { SplitterGroup, SplitterPanel, SplitterResizeHandle } from 'reka-ui'
+import { tv } from 'tailwind-variants'
+import { computed, ref } from 'vue'
import { useI18n } from '@open-pencil/vue'
import type { ToolChange } from '@/app/ai/tools/changes/types'
-import SegmentedControl from '@/components/ui/select/SegmentedControl.vue'
+import CodeViewer from '@/components/code-editor/LazyCodeViewer.vue'
+import IconButton from '@/components/ui/button/IconButton.vue'
import { chatToolTheme } from '@/theme/chat/tool'
-
-const CodeViewer = defineAsyncComponent(() => import('@/components/code-editor/CodeViewer.vue'))
+import splitterTheme from '@/theme/splitter'
const { change } = defineProps<{ change: ToolChange }>()
const { ai } = useI18n()
const ui = chatToolTheme()
+const splitter = tv(splitterTheme)({ direction: 'horizontal' })
const beforeURL = useObjectUrl(() => change.images?.before ?? undefined)
const afterURL = useObjectUrl(() => change.images?.after ?? undefined)
const highlightURL = useObjectUrl(() => change.images?.highlight ?? undefined)
-const mode = ref<'compare' | 'highlight'>('compare')
-const modeOptions = computed(() => [
- { value: 'compare', label: ai.value.changeCompare },
- { value: 'highlight', label: ai.value.changeHighlight }
-])
-/** Share of the comparison that shows the before state, from the left edge. */
-const split = ref(50)
+/** Shows the changed pixels over the faded result instead of the before and after split. */
+const highlight = ref(false)
const changedPercent = computed(() => {
const ratio = change.images?.changedRatio ?? 0
return ratio > 0 && ratio < 0.001 ? '<0.1' : (ratio * 100).toFixed(ratio < 0.1 ? 1 : 0)
@@ -42,53 +40,49 @@ const aspectRatio = computed(() =>
<div class="space-y-2" data-slot="chat-tool-change">
<template v-if="hasImages">
<div class="flex items-center justify-between gap-2">
- <SegmentedControl v-model="mode" :options="modeOptions" :label="ai.changeView" size="sm" />
<span class="text-[10px] text-muted">
{{ visible ? ai.changedPixels({ percent: changedPercent }) : ai.noVisibleChange }}
</span>
+ <IconButton
+ v-if="highlightURL"
+ :active="highlight"
+ :aria-pressed="highlight"
+ :label="ai.changeHighlight"
+ data-slot="chat-tool-change-highlight"
+ @click="highlight = !highlight"
+ >
+ <icon-lucide-highlighter class="size-3.5" />
+ </IconButton>
</div>
<div
:class="ui.compare()"
:style="{ aspectRatio }"
- :data-mode="mode"
+ :data-mode="highlight ? 'highlight' : 'compare'"
data-slot="chat-tool-change-images"
>
- <img v-if="afterURL" :src="afterURL" :alt="ai.changeAfter" :class="ui.compareImage()" />
- <img
- v-if="mode === 'compare' && beforeURL"
- :src="beforeURL"
- :alt="ai.changeBefore"
- :class="ui.compareImage()"
- :style="{ clipPath: `inset(0 ${100 - split}% 0 0)` }"
- />
- <div
- v-if="mode === 'compare'"
- :class="ui.compareDivider()"
- :style="{ left: `${split}%` }"
- aria-hidden="true"
- />
- <img
- v-if="mode === 'highlight' && highlightURL"
- :src="highlightURL"
- alt=""
- :class="ui.compareImage()"
- />
- <span v-if="mode === 'compare'" :class="ui.compareLabel({ class: 'left-1' })">
- {{ ai.changeBefore }}
- </span>
- <span v-if="mode === 'compare'" :class="ui.compareLabel({ class: 'right-1' })">
- {{ ai.changeAfter }}
- </span>
+ <template v-if="highlight">
+ <img v-if="afterURL" :src="afterURL" :alt="ai.changeAfter" :class="ui.compareImage()" />
+ <img :src="highlightURL" alt="" :class="ui.compareImage()" />
+ </template>
+ <SplitterGroup v-else direction="horizontal" :class="ui.compareSplit()">
+ <SplitterPanel :default-size="50" :class="ui.comparePanel()">
+ <img
+ v-if="beforeURL"
+ :src="beforeURL"
+ :alt="ai.changeBefore"
+ :class="ui.compareBefore()"
+ />
+ <span :class="ui.compareLabel({ class: 'left-1' })">{{ ai.changeBefore }}</span>
+ </SplitterPanel>
+ <SplitterResizeHandle :class="splitter.handle()" :aria-label="ai.changeSplit">
+ <div :class="splitter.divider({ class: ui.compareDivider() })" />
+ </SplitterResizeHandle>
+ <SplitterPanel :default-size="50" :class="ui.comparePanel()">
+ <img v-if="afterURL" :src="afterURL" :alt="ai.changeAfter" :class="ui.compareAfter()" />
+ <span :class="ui.compareLabel({ class: 'right-1' })">{{ ai.changeAfter }}</span>
+ </SplitterPanel>
+ </SplitterGroup>
</div>
- <input
- v-if="mode === 'compare'"
- v-model.number="split"
- type="range"
- min="0"
- max="100"
- :aria-label="ai.changeSplit"
- :class="ui.compareSlider()"
- />
</template>
<CodeViewer
:code="change.jsx.after"
diff --git a/src/components/code-editor/LazyCodeViewer.vue b/src/components/code-editor/LazyCodeViewer.vue
new file mode 100644
index 000000000..100c38303
--- /dev/null
+++ b/src/components/code-editor/LazyCodeViewer.vue
@@ -0,0 +1,27 @@
+<script setup lang="ts">
+import { computed, defineAsyncComponent } from 'vue'
+
+import type { CodeViewerLanguage } from '@/components/code-editor/CodeViewer.vue'
+import { codeViewerHeight, loadCodeViewer } from '@/components/code-editor/lazy'
+
+// CodeMirror loads with the first viewer shown, not with the screen that may show one.
+const CodeViewer = defineAsyncComponent(loadCodeViewer)
+
+const { code, language, label, original } = defineProps<{
+ code: string
+ language: CodeViewerLanguage
+ label: string
+ original?: string
+}>()
+
+// A diff collapses unchanged lines, so only plain code has a height known in advance.
+const minHeight = computed(() =>
+ original === undefined ? `${codeViewerHeight(code)}px` : undefined
+)
+</script>
+
+<template>
+ <div :style="{ minHeight }">
+ <CodeViewer :code="code" :language="language" :label="label" :original="original" />
+ </div>
+</template>
diff --git a/src/components/code-editor/lazy.ts b/src/components/code-editor/lazy.ts
new file mode 100644
index 000000000..070eb58c5
--- /dev/null
+++ b/src/components/code-editor/lazy.ts
@@ -0,0 +1,19 @@
+/** Loads CodeMirror and the viewer; the module is cached, so calling it again is free. */
+export function loadCodeViewer() {
+ return import('@/components/code-editor/CodeViewer.vue')
+}
+
+/** Mirrors `codeViewerTheme`: 10.5px text at a 1.55 line height, 6px padding, 16rem at most. */
+const LINE_HEIGHT = 10.5 * 1.55
+const PADDING_Y = 12
+const BORDER_Y = 2
+const MAX_HEIGHT = 256
+
+/**
+ * The height the viewer takes for `code` before line wrapping, so a collapsible measuring its
+ * content while CodeMirror loads or lays out its lines opens to the right height.
+ */
+export function codeViewerHeight(code: string): number {
+ const lines = code.split('\n').length
+ return Math.min(lines * LINE_HEIGHT + PADDING_Y, MAX_HEIGHT) + BORDER_Y
+}
diff --git a/src/theme/chat/profile.ts b/src/theme/chat/profile.ts
index 9de22ea25..e61580696 100644
--- a/src/theme/chat/profile.ts
+++ b/src/theme/chat/profile.ts
@@ -1,5 +1,7 @@
import { tv } from 'tailwind-variants'
+import { motionStyles } from '../motion/styles'
+
export const chatProfileTheme = tv({
slots: {
trigger:
@@ -7,7 +9,7 @@ export const chatProfileTheme = tv({
triggerIcon: 'size-3 shrink-0',
triggerValue: 'min-w-0 truncate',
triggerChevron: 'size-2.5 shrink-0',
- content: 'w-72 max-w-[calc(100vw-1rem)] overflow-hidden',
+ content: ['w-72 max-w-[calc(100vw-1rem)] overflow-hidden', motionStyles.floating],
viewport: 'max-h-72 p-1',
header: 'px-2 pt-1.5 pb-2',
headerLabel: 'text-[9px] font-medium tracking-wide text-muted uppercase',
diff --git a/src/theme/chat/tool.ts b/src/theme/chat/tool.ts
index fe315f464..a0d05eb9e 100644
--- a/src/theme/chat/tool.ts
+++ b/src/theme/chat/tool.ts
@@ -22,15 +22,20 @@ export const chatToolTheme = tv({
compare:
'relative w-full max-w-full overflow-hidden rounded border border-border bg-input select-none data-[mode=highlight]:[&>img:first-child]:opacity-40',
compareImage: 'absolute inset-0 size-full object-contain',
- compareDivider:
- 'pointer-events-none absolute inset-y-0 w-px -translate-x-1/2 bg-accent shadow-[0_0_0_1px_rgb(0_0_0/0.25)]',
+ // `cqw` is the split's width, so each side draws the whole image and its panel crops it.
+ compareSplit: '@container absolute inset-0',
+ comparePanel: 'relative h-full overflow-hidden',
+ compareBefore: 'absolute inset-y-0 left-0 h-full w-[100cqw] max-w-none object-contain',
+ compareAfter: 'absolute inset-y-0 right-0 h-full w-[100cqw] max-w-none object-contain',
+ compareDivider: 'bg-accent shadow-[0_0_0_1px_rgb(0_0_0/0.25)]',
compareLabel:
'pointer-events-none absolute top-1 rounded bg-black/55 px-1 py-px text-[9px] font-medium text-white',
- compareSlider: 'block w-full accent-(--color-accent)',
group: 'rounded-lg border border-dashed border-border',
groupTrigger:
- 'flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 text-left text-[11px] text-muted hover:bg-hover hover:text-surface',
+ 'flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 text-left text-[11px] text-muted hover:bg-hover hover:text-surface',
groupIcon: 'size-3.5 shrink-0 text-accent',
+ groupNames: 'min-w-0 flex-1 truncate',
+ groupFailed: 'bg-red-500/20 text-red-400',
groupItems: 'space-y-1.5 px-1.5 pb-1.5'
}
})
diff --git a/tests/e2e/chat/history.spec.ts b/tests/e2e/chat/history.spec.ts
index 906f9d8ef..e8589ea59 100644
--- a/tests/e2e/chat/history.spec.ts
+++ b/tests/e2e/chat/history.spec.ts
@@ -23,7 +23,12 @@ test('multiple conversations preserve messages and manual titles', async ({
const actions = page.getByRole('button', { name: 'Conversation actions' })
const triggerBox = await actions.boundingBox()
await actions.click()
- const menuBox = await page.getByRole('menu').boundingBox()
+ const menu = page.getByRole('menu')
+ // Measure where the menu settles, not a frame of its entrance.
+ await menu.evaluate(async (element) => {
+ await Promise.all(element.getAnimations().map((animation) => animation.finished))
+ })
+ const menuBox = await menu.boundingBox()
expect(triggerBox).not.toBeNull()
expect(menuBox).not.toBeNull()
if (!triggerBox || !menuBox) throw new Error('Missing menu geometry')