Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): align composer row, opaque collapse tab (PRD-8651, PRD-8730) (#4732)

Abrahama8d4752f12ae
diff --git a/.changeset/prd-8651-8730-composer-alignment-collapse-tab.md b/.changeset/prd-8651-8730-composer-alignment-collapse-tab.md
new file mode 100644
index 000000000..9127b32e6
--- /dev/null
+++ b/.changeset/prd-8651-8730-composer-alignment-collapse-tab.md
@@ -0,0 +1,5 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+The Ask AI composer's attach button, prompt text and agent picker now sit on a common centre line instead of three different ones, and the tab that collapses the composer paints a solid fill in dark mode, so the composer edge it sits on no longer shows through it.
diff --git a/packages/app/package.json b/packages/app/package.json
index d60daac17..02b02c1c6 100644
--- a/packages/app/package.json
+++ b/packages/app/package.json
@@ -37,7 +37,7 @@
"measure:stress": "bash scripts/measure-stress.sh",
"measure:sweep": "bash scripts/measure-sweep.sh",
"perf:compare": "bash scripts/perf-compare.sh",
- "test:e2e": "playwright test tests/stress/list-item-drag.e2e.ts tests/stress/ux-interactions.e2e.ts tests/stress/file-tree-create.e2e.ts tests/stress/file-tree-drag-to-root.e2e.ts tests/stress/file-tree-deselect-to-root.e2e.ts tests/stress/file-tree-collapse-spaced-folder.e2e.ts tests/stress/sidebar-file-list-fills.e2e.ts tests/stress/file-tree-sticky-collapse.e2e.ts tests/stress/file-tree-collapse-persistence.e2e.ts tests/stress/file-tree-fractional-zoom.e2e.ts tests/stress/create-then-rename-editable.e2e.ts tests/stress/find-replace.e2e.ts tests/stress/editor-tabs.e2e.ts tests/stress/crdt-stress.e2e.ts tests/stress/slash-command.e2e.ts tests/stress/paste-fidelity.e2e.ts tests/stress/fr-7a-disconnect-source-mode.e2e.ts tests/stress/docs-open.e2e.ts tests/stress/frozen-table-headers.e2e.ts tests/stress/asset-embed.e2e.ts tests/stress/asset-embed-advanced.e2e.ts tests/stress/asset-click-dispatch.e2e.ts tests/stress/handoff.e2e.ts tests/stress/multi-agent-presence.e2e.ts tests/stress/editor-mode-persistence.e2e.ts tests/stress/lint-config-toggle.e2e.ts tests/stress/plugin-enable-notice.e2e.ts tests/stress/schema-edit-fields-view.e2e.ts tests/stress/sidebar-search-pill.e2e.ts tests/stress/navigation-history.e2e.ts tests/stress/command-palette-semantic.e2e.ts tests/stress/agent-activity-panel.e2e.ts tests/stress/drop-pipeline-auto-open.e2e.ts tests/stress/command-palette-flicker.e2e.ts tests/stress/cm6-list-hanging-indent.e2e.ts tests/stress/ng7-rapid-nav-coherence.e2e.ts tests/stress/reveal-on-activate.e2e.ts tests/stress/selection-indicator.e2e.ts tests/stress/new-file-cross-doc-bleed.e2e.ts tests/stress/new-item-shortcut-fast-path.e2e.ts tests/stress/editor-mode-flip-cross-doc-bleed.e2e.ts tests/stress/editor-area-viewport-resize.e2e.ts tests/stress/qa-sidebar-responsive.e2e.ts tests/stress/prd-6955-reassertion-repro.e2e.ts tests/stress/prd-6955-reassertion-wedge.e2e.ts tests/stress/prd-6914-repro.e2e.ts tests/stress/showall-lazy-tree.e2e.ts tests/stress/tabs-component-strip.e2e.ts tests/stress/source-find-scroll.e2e.ts tests/stress/harness-app-warmth.e2e.ts tests/stress/qa-canary-authoring-both-modes.e2e.ts tests/stress/qa-canary-live-typing.e2e.ts tests/stress/keystroke-cadence-danger-space.e2e.ts tests/stress/jsx-unregistered-backspace-delete.e2e.ts tests/stress/jsx-unregistered-ime-concurrent.e2e.ts tests/stress/jsx-backspace-delete.e2e.ts tests/stress/link-authoring-bytes.e2e.ts tests/stress/link-authoring-apex.e2e.ts tests/stress/command-palette-parity.e2e.ts tests/stress/settings-search.e2e.ts tests/stress/okf-generated-index-settings.e2e.ts tests/stress/okf-recommended-skill-install.e2e.ts tests/stress/chip-popover-positioning.e2e.ts tests/stress/docs-open-scroll-restore.e2e.ts tests/stress/file-tree-decoration-chip-strip-repro.e2e.ts tests/stress/grip-click-nodeselect.e2e.ts tests/stress/jsx-halo-semantics.e2e.ts tests/stress/jsx-image-body-click.e2e.ts tests/stress/jsx-prop-panel-placeholder.e2e.ts tests/stress/jsx-range-encompass-halo.e2e.ts tests/stress/jsx-wildcard-convert.e2e.ts tests/stress/markdown-lint.e2e.ts tests/stress/frontmatter-schema-badge.e2e.ts tests/stress/frontmatter-glob-picker.e2e.ts tests/stress/unified-problems.e2e.ts tests/stress/mid-type-recovery.e2e.ts tests/stress/observer-a-multi-client.e2e.ts tests/stress/outline-toolbar-occlusion.e2e.ts tests/stress/selection-surface-pane-clip.e2e.ts tests/stress/quiet-tree-hidden-doc.e2e.ts tests/stress/raw-mdx-fallback-onblur-upgrade.e2e.ts tests/stress/rename-noext-probe.e2e.ts tests/stress/show-ok-folders.e2e.ts tests/stress/source-polish.e2e.ts tests/stress/warm-skeleton-scroll-restore.e2e.ts tests/stress/props-toggle-scroll-preserve.e2e.ts tests/stress/yjs-no-dual-import.e2e.ts tests/stress/graph-panel-surfaces.e2e.ts tests/stress/asset-embed-real-fidelity.e2e.ts tests/stress/image-invalid-placeholder.e2e.ts tests/stress/local-target-audit.e2e.ts tests/stress/rename-content-preservation.e2e.ts tests/stress/rename-consolidation.e2e.ts tests/stress/outline-active-heading.e2e.ts tests/stress/outline-navigation.e2e.ts tests/stress/prd-7627-default-swatch.e2e.ts tests/stress/clipboard-dollar-math-source-fallback.e2e.ts tests/stress/source-mode-undo-keymap.e2e.ts tests/stress/source-undo-mode-flip.e2e.ts tests/stress/timeline-recovered-restore.e2e.ts tests/stress/blank-line-preservation.e2e.ts tests/stress/landing-helpers.e2e.ts tests/stress/agent-follow-scroll.e2e.ts tests/stress/mode-switch-landing.e2e.ts tests/stress/mode-switch-ordinal-divergence.e2e.ts tests/stress/comment-annotation-visibility.e2e.ts tests/stress/comment-opens-in-panel.e2e.ts tests/stress/qa-miles-edge-blanks.e2e.ts tests/stress/prop-upload.e2e.ts tests/stress/slash-command-auto-open.e2e.ts tests/stress/clipboard-relative-url-source-fallback.e2e.ts tests/stress/editor-split-view.e2e.ts tests/stress/language-load-failure.e2e.ts tests/stress/language-first-paint.e2e.ts tests/stress/user-text-direction.e2e.ts tests/stress/pseudolocale.e2e.ts tests/stress/language-picker.e2e.ts tests/stress/zh-hans-coverage-sweep.e2e.ts tests/stress/preview-tab-promotion.e2e.ts tests/stress/cv-paint-lock-click.e2e.ts tests/stress/cv-auto-paint-lock-click.e2e.ts tests/stress/history-traversal-preview-tab.e2e.ts tests/stress/tab-close-scroll-restore.e2e.ts tests/stress/skills-sidebar-open.e2e.ts tests/stress/trailing-affordance.e2e.ts tests/stress/text-doc-composer-inset.e2e.ts tests/stress/agents-settings-accessible-names.e2e.ts tests/stress/composer-growth-eof-reveal.e2e.ts tests/stress/theme-fade.e2e.ts tests/stress/theme-color-conversion.e2e.ts tests/stress/composer-open-caret-reveal.e2e.ts tests/stress/spellcheck-browser-absence.e2e.ts tests/stress/agents-panel-reload-visibility.e2e.ts",
+ "test:e2e": "playwright test tests/stress/list-item-drag.e2e.ts tests/stress/ux-interactions.e2e.ts tests/stress/file-tree-create.e2e.ts tests/stress/file-tree-drag-to-root.e2e.ts tests/stress/file-tree-deselect-to-root.e2e.ts tests/stress/file-tree-collapse-spaced-folder.e2e.ts tests/stress/sidebar-file-list-fills.e2e.ts tests/stress/file-tree-sticky-collapse.e2e.ts tests/stress/file-tree-collapse-persistence.e2e.ts tests/stress/file-tree-fractional-zoom.e2e.ts tests/stress/create-then-rename-editable.e2e.ts tests/stress/find-replace.e2e.ts tests/stress/editor-tabs.e2e.ts tests/stress/crdt-stress.e2e.ts tests/stress/slash-command.e2e.ts tests/stress/paste-fidelity.e2e.ts tests/stress/fr-7a-disconnect-source-mode.e2e.ts tests/stress/docs-open.e2e.ts tests/stress/frozen-table-headers.e2e.ts tests/stress/asset-embed.e2e.ts tests/stress/asset-embed-advanced.e2e.ts tests/stress/asset-click-dispatch.e2e.ts tests/stress/handoff.e2e.ts tests/stress/multi-agent-presence.e2e.ts tests/stress/editor-mode-persistence.e2e.ts tests/stress/lint-config-toggle.e2e.ts tests/stress/plugin-enable-notice.e2e.ts tests/stress/schema-edit-fields-view.e2e.ts tests/stress/sidebar-search-pill.e2e.ts tests/stress/navigation-history.e2e.ts tests/stress/command-palette-semantic.e2e.ts tests/stress/agent-activity-panel.e2e.ts tests/stress/drop-pipeline-auto-open.e2e.ts tests/stress/command-palette-flicker.e2e.ts tests/stress/cm6-list-hanging-indent.e2e.ts tests/stress/ng7-rapid-nav-coherence.e2e.ts tests/stress/reveal-on-activate.e2e.ts tests/stress/selection-indicator.e2e.ts tests/stress/new-file-cross-doc-bleed.e2e.ts tests/stress/new-item-shortcut-fast-path.e2e.ts tests/stress/editor-mode-flip-cross-doc-bleed.e2e.ts tests/stress/editor-area-viewport-resize.e2e.ts tests/stress/qa-sidebar-responsive.e2e.ts tests/stress/prd-6955-reassertion-repro.e2e.ts tests/stress/prd-6955-reassertion-wedge.e2e.ts tests/stress/prd-6914-repro.e2e.ts tests/stress/showall-lazy-tree.e2e.ts tests/stress/tabs-component-strip.e2e.ts tests/stress/source-find-scroll.e2e.ts tests/stress/harness-app-warmth.e2e.ts tests/stress/qa-canary-authoring-both-modes.e2e.ts tests/stress/qa-canary-live-typing.e2e.ts tests/stress/keystroke-cadence-danger-space.e2e.ts tests/stress/jsx-unregistered-backspace-delete.e2e.ts tests/stress/jsx-unregistered-ime-concurrent.e2e.ts tests/stress/jsx-backspace-delete.e2e.ts tests/stress/link-authoring-bytes.e2e.ts tests/stress/link-authoring-apex.e2e.ts tests/stress/command-palette-parity.e2e.ts tests/stress/settings-search.e2e.ts tests/stress/okf-generated-index-settings.e2e.ts tests/stress/okf-recommended-skill-install.e2e.ts tests/stress/chip-popover-positioning.e2e.ts tests/stress/docs-open-scroll-restore.e2e.ts tests/stress/file-tree-decoration-chip-strip-repro.e2e.ts tests/stress/grip-click-nodeselect.e2e.ts tests/stress/jsx-halo-semantics.e2e.ts tests/stress/jsx-image-body-click.e2e.ts tests/stress/jsx-prop-panel-placeholder.e2e.ts tests/stress/jsx-range-encompass-halo.e2e.ts tests/stress/jsx-wildcard-convert.e2e.ts tests/stress/markdown-lint.e2e.ts tests/stress/frontmatter-schema-badge.e2e.ts tests/stress/frontmatter-glob-picker.e2e.ts tests/stress/unified-problems.e2e.ts tests/stress/mid-type-recovery.e2e.ts tests/stress/observer-a-multi-client.e2e.ts tests/stress/outline-toolbar-occlusion.e2e.ts tests/stress/selection-surface-pane-clip.e2e.ts tests/stress/quiet-tree-hidden-doc.e2e.ts tests/stress/raw-mdx-fallback-onblur-upgrade.e2e.ts tests/stress/rename-noext-probe.e2e.ts tests/stress/show-ok-folders.e2e.ts tests/stress/source-polish.e2e.ts tests/stress/warm-skeleton-scroll-restore.e2e.ts tests/stress/props-toggle-scroll-preserve.e2e.ts tests/stress/yjs-no-dual-import.e2e.ts tests/stress/graph-panel-surfaces.e2e.ts tests/stress/asset-embed-real-fidelity.e2e.ts tests/stress/image-invalid-placeholder.e2e.ts tests/stress/local-target-audit.e2e.ts tests/stress/rename-content-preservation.e2e.ts tests/stress/rename-consolidation.e2e.ts tests/stress/outline-active-heading.e2e.ts tests/stress/outline-navigation.e2e.ts tests/stress/prd-7627-default-swatch.e2e.ts tests/stress/clipboard-dollar-math-source-fallback.e2e.ts tests/stress/source-mode-undo-keymap.e2e.ts tests/stress/source-undo-mode-flip.e2e.ts tests/stress/timeline-recovered-restore.e2e.ts tests/stress/blank-line-preservation.e2e.ts tests/stress/landing-helpers.e2e.ts tests/stress/agent-follow-scroll.e2e.ts tests/stress/mode-switch-landing.e2e.ts tests/stress/mode-switch-ordinal-divergence.e2e.ts tests/stress/comment-annotation-visibility.e2e.ts tests/stress/comment-opens-in-panel.e2e.ts tests/stress/qa-miles-edge-blanks.e2e.ts tests/stress/prop-upload.e2e.ts tests/stress/slash-command-auto-open.e2e.ts tests/stress/clipboard-relative-url-source-fallback.e2e.ts tests/stress/editor-split-view.e2e.ts tests/stress/language-load-failure.e2e.ts tests/stress/language-first-paint.e2e.ts tests/stress/user-text-direction.e2e.ts tests/stress/pseudolocale.e2e.ts tests/stress/language-picker.e2e.ts tests/stress/zh-hans-coverage-sweep.e2e.ts tests/stress/preview-tab-promotion.e2e.ts tests/stress/cv-paint-lock-click.e2e.ts tests/stress/cv-auto-paint-lock-click.e2e.ts tests/stress/history-traversal-preview-tab.e2e.ts tests/stress/tab-close-scroll-restore.e2e.ts tests/stress/skills-sidebar-open.e2e.ts tests/stress/trailing-affordance.e2e.ts tests/stress/text-doc-composer-inset.e2e.ts tests/stress/composer-control-alignment.e2e.ts tests/stress/agents-settings-accessible-names.e2e.ts tests/stress/composer-growth-eof-reveal.e2e.ts tests/stress/theme-fade.e2e.ts tests/stress/theme-color-conversion.e2e.ts tests/stress/composer-open-caret-reveal.e2e.ts tests/stress/spellcheck-browser-absence.e2e.ts tests/stress/agents-panel-reload-visibility.e2e.ts",
"test:e2e:install-browsers": "playwright install chromium webkit firefox",
"test:visual": "playwright test --config playwright.visual.config.ts",
"test:visual:update": "playwright test --config playwright.visual.config.ts --update-snapshots",
diff --git a/packages/app/src/components/BottomComposer.dom.test.tsx b/packages/app/src/components/BottomComposer.dom.test.tsx
index aa878de1e..ed08599be 100644
--- a/packages/app/src/components/BottomComposer.dom.test.tsx
+++ b/packages/app/src/components/BottomComposer.dom.test.tsx
@@ -1220,6 +1220,17 @@ describe('BottomComposer (dismiss / reopen)', () => {
});
});
+describe('BottomComposer (collapse tab)', () => {
+ test('the collapse tab paints its own opaque fill, so the border it straddles cannot show through', async () => {
+ await renderComposer('notes');
+
+ const tab = screen.getByTestId('ask-ai-collapse');
+ expect(tab.className).toContain('dark:bg-background');
+ expect(tab.className).toContain('dark:hover:bg-muted');
+ expect(tab.className).not.toMatch(/dark:bg-input\/30/);
+ });
+});
+
describe('BottomComposer (conflict footer stacking)', () => {
test('the wrapper anchors its bottom to --conflict-footer-height, not a hard bottom-0', async () => {
await renderComposer('notes');
diff --git a/packages/app/src/components/BottomComposer.tsx b/packages/app/src/components/BottomComposer.tsx
index 8cdcc458d..8f8707b44 100644
--- a/packages/app/src/components/BottomComposer.tsx
+++ b/packages/app/src/components/BottomComposer.tsx
@@ -749,7 +749,7 @@ export function BottomComposer({
aria-label={t`Collapse Ask AI`}
onClick={() => onDismiss?.()}
data-testid="ask-ai-collapse"
- className="-top-2.5 -translate-x-1/2 absolute left-1/2 z-10 h-5 w-10 rounded-md p-0 text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100"
+ className="-top-2.5 -translate-x-1/2 absolute left-1/2 z-10 h-5 w-10 rounded-md p-0 text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100 dark:bg-background dark:hover:bg-muted"
>
<ChevronDown className="size-3.5" aria-hidden />
</Button>
@@ -867,9 +867,9 @@ export function BottomComposer({
</div>
<div className="flex items-end gap-2">
{attachmentsAccepted ? (
- <AttachFilesButton testId="ask-ai-attach-files" onFiles={ingestFiles} />
+ <AttachFilesButton testId="ask-ai-attach-files" onFiles={ingestFiles} size="icon" />
) : null}
- <div className="relative flex-1">
+ <div className="relative flex min-h-8 flex-1 flex-col justify-center">
<ComposerMentionInput
ref={inputRef}
ariaLabel={t`Ask AI`}
@@ -889,12 +889,12 @@ export function BottomComposer({
<div
aria-hidden
className={cn(
- 'pointer-events-none absolute inset-0 truncate px-0 py-1 text-base text-muted-foreground/60 md:text-sm',
+ 'pointer-events-none absolute inset-0 flex items-center px-0 py-0 text-base text-muted-foreground/60 md:text-sm',
!reduced && 'transition-opacity duration-500 ease-in-out',
suggestion.visible ? 'opacity-100' : 'opacity-0',
)}
>
- {suggestion.text}
+ <span className="min-w-0 truncate">{suggestion.text}</span>
</div>
) : null}
</div>
@@ -966,6 +966,7 @@ export function BottomComposer({
menuAttributes={COMPOSER_PORTAL_ATTRIBUTES}
triggerAriaLabel={t`Choose agent`}
testIds={{
+ group: 'ask-ai-agent-group',
primary: 'ask-ai-send',
trigger: 'ask-ai-agent-trigger',
menu: 'ask-ai-agent-menu',
diff --git a/packages/app/src/components/acp/AttachFilesButton.tsx b/packages/app/src/components/acp/AttachFilesButton.tsx
index eb1d633ec..dcb18b52a 100644
--- a/packages/app/src/components/acp/AttachFilesButton.tsx
+++ b/packages/app/src/components/acp/AttachFilesButton.tsx
@@ -1,6 +1,6 @@
import { useLingui } from '@lingui/react/macro';
import { Plus } from 'lucide-react';
-import type { ReactNode } from 'react';
+import type { ComponentProps, ReactNode } from 'react';
import { Button } from '@/components/ui/button';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
@@ -8,10 +8,12 @@ export function AttachFilesButton({
onFiles,
referencesOnly = false,
testId,
+ size = 'icon-sm',
}: {
onFiles: (files: readonly File[]) => Promise<void> | void;
referencesOnly?: boolean;
testId: string;
+ size?: Extract<ComponentProps<typeof Button>['size'], 'icon-sm' | 'icon'>;
}): ReactNode {
const { t } = useLingui();
const openFilePicker = () => {
@@ -29,7 +31,7 @@ export function AttachFilesButton({
<TooltipTrigger asChild>
<Button
type="button"
- size="icon-sm"
+ size={size}
variant="ghost"
className="rounded-lg"
onClick={openFilePicker}
diff --git a/packages/app/src/components/handoff/AgentSplitButton.tsx b/packages/app/src/components/handoff/AgentSplitButton.tsx
index 729e0fbb8..31f4f4efd 100644
--- a/packages/app/src/components/handoff/AgentSplitButton.tsx
+++ b/packages/app/src/components/handoff/AgentSplitButton.tsx
@@ -38,6 +38,7 @@ export interface ThreadAgentRow {
}
export interface AgentSplitButtonTestIds {
+ group?: string;
primary: string;
trigger: string;
menu: string;
@@ -109,7 +110,7 @@ export function AgentSplitButton({
typeof testIds.terminal === 'function' ? testIds.terminal(cli) : testIds.terminal;
return (
- <ButtonGroup className={className}>
+ <ButtonGroup className={className} data-testid={testIds.group}>
<Button
type="button"
variant="outline"
diff --git a/packages/app/src/globals.css b/packages/app/src/globals.css
index b460c8ce5..ff01522f9 100644
--- a/packages/app/src/globals.css
+++ b/packages/app/src/globals.css
@@ -1337,12 +1337,8 @@
line-height: 1.5;
margin-left: 0;
padding-left: 0;
- /* No trailing dead zone either: nothing can follow a one-line prompt, so the
- affordance never engages here and the pad would only add dead space. The
- token needs no reset — this element is excluded from the opt-in rule that
- grants it — but the padding does, because the scroller rule adds the
- composer's own height on top. */
- padding-bottom: 0;
+ /* STOP: 0.25rem mirrors this element's own `py-1` top; 0 un-centres the composer row. */
+ padding-bottom: 0.25rem;
/* Drop the right gutter mirror too — the slim composer is a single-line prompt,
not a document body, so it needs neither the drag-handle hit area nor the
full-width-block border slack. */
diff --git a/packages/app/tests/stress/_helpers/acp-catalog.ts b/packages/app/tests/stress/_helpers/acp-catalog.ts
new file mode 100644
index 000000000..f09ab7f94
--- /dev/null
+++ b/packages/app/tests/stress/_helpers/acp-catalog.ts
@@ -0,0 +1,27 @@
+import type { AgentCatalog, CatalogAgent } from '@/lib/acp/catalog';
+
+const DEFAULT_AGENT: CatalogAgent = {
+ id: 'catalog-agent',
+ name: 'Catalog Agent',
+ version: '1.0.0',
+ source: 'registry',
+ supported: true,
+ featured: false,
+ harness: { cli: 'claude', availability: 'present', credentials: 'present' },
+};
+
+export function acpCatalogBody(
+ agents: readonly Partial<CatalogAgent>[] = [{}],
+ envelope: Partial<Omit<AgentCatalog, 'agents'>> = {},
+): AgentCatalog {
+ return {
+ agents: agents.map((agent, index) => ({
+ ...DEFAULT_AGENT,
+ id: `${DEFAULT_AGENT.id}-${index}`,
+ name: `${DEFAULT_AGENT.name} ${index}`,
+ ...agent,
+ })),
+ stale: envelope.stale ?? false,
+ maxThreads: envelope.maxThreads ?? 8,
+ };
+}
diff --git a/packages/app/tests/stress/_helpers/index.ts b/packages/app/tests/stress/_helpers/index.ts
index c9c3912d2..8c395d932 100644
--- a/packages/app/tests/stress/_helpers/index.ts
+++ b/packages/app/tests/stress/_helpers/index.ts
@@ -1,3 +1,4 @@
+export { acpCatalogBody } from './acp-catalog.ts';
export { simulateCopyAndRead, simulateCutAndRead } from './clipboard.ts';
export { resetContentToFixtureBaseline } from './content-reset.ts';
export {
diff --git a/packages/app/tests/stress/composer-control-alignment.e2e.ts b/packages/app/tests/stress/composer-control-alignment.e2e.ts
new file mode 100644
index 000000000..af72e53b0
--- /dev/null
+++ b/packages/app/tests/stress/composer-control-alignment.e2e.ts
@@ -0,0 +1,107 @@
+import { randomUUID } from 'node:crypto';
+import { acpCatalogBody, expect, test } from './_helpers';
+
+const WYSIWYG_BODY = '.editor-doc-scroll .ProseMirror:not(.composer-prosemirror)';
+const COMPOSER_CARD = '[data-testid="bottom-composer"] > div';
+const ATTACH = '[data-testid="ask-ai-attach-files"]';
+const COMPOSER_INPUT = '.composer-prosemirror';
+const PICKER = '[data-testid="ask-ai-agent-group"]';
+
+const FIRST_PAINT_TIMEOUT_MS = 30_000;
+const SETTLE_TIMEOUT_MS = 15_000;
+const CENTRE_TOLERANCE_PX = 1;
+
+const WHY = [
+ 'the attach button, the prompt text and the agent picker no longer share a centre line.',
+ '',
+ 'Three production knobs place that line, and reverting any one of them alone reopens the',
+ 'spread past this tolerance:',
+ ' 1. size="icon" on AttachFilesButton in BottomComposer, so it matches the picker height',
+ ' 2. min-h-8 flex flex-col justify-center on the prompt column, giving the first line box',
+ ' the control height while going inert once the input grows past one line',
+ ' 3. padding-bottom: 0.25rem on .ProseMirror.composer-prosemirror, which makes the input box',
+ ' symmetric — with 0 it is taller above the glyphs than below, so aligning boxes cannot',
+ ' align what a reader sees',
+ '',
+ 'The row is items-end so the buttons stay beside the last line of a grown prompt, which means',
+ 'equal heights are what produce equal centres. Only a browser tier reads the compiled',
+ 'stylesheet: the jsdom suite mocks the input and loads no CSS, so nothing there can see this.',
+].join('\n');
+
+test.describe('Ask AI composer control alignment', () => {
+ test('the attach button, the prompt text and the agent picker share one centre line', async ({
+ page,
+ api,
+ }) => {
+ const docName = `composer-alignment-${randomUUID().slice(0, 8)}`;
+ await api.seedDocs([{ name: `${docName}.md`, markdown: 'Alignment fixture.\n' }]);
+ await page.route('**/api/installed-agents', (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({ claude: true }),
+ }),
+ );
+ await page.route('**/api/acp/catalog', (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify(acpCatalogBody([{ id: 'alignment-agent', name: 'Alignment Agent' }])),
+ }),
+ );
+
+ await page.goto(`/#/${docName}`);
+ await expect(page.locator(WYSIWYG_BODY).first()).toBeVisible({
+ timeout: FIRST_PAINT_TIMEOUT_MS,
+ });
+ await expect(page.locator(COMPOSER_CARD).first()).toBeVisible({
+ timeout: FIRST_PAINT_TIMEOUT_MS,
+ });
+ await expect(
+ page.locator(ATTACH).first(),
+ 'the composer rendered without its attach control, so the row this test measures is not the ' +
+ 'three-control row it exists to pin',
+ ).toBeVisible({ timeout: FIRST_PAINT_TIMEOUT_MS });
+ await expect(page.locator(COMPOSER_INPUT).first()).toBeVisible({
+ timeout: FIRST_PAINT_TIMEOUT_MS,
+ });
+ await expect(page.locator(PICKER).first()).toBeVisible({ timeout: FIRST_PAINT_TIMEOUT_MS });
+
+ await expect
+ .poll(
+ () =>
+ page.evaluate(
+ ({ attachSel, inputSel, pickerSel }) => {
+ const resolve = (selector: string): HTMLElement => {
+ const found = document.querySelector(selector);
+ if (!(found instanceof HTMLElement)) {
+ throw new Error(`no painted element for ${selector}`);
+ }
+ return found;
+ };
+ const attach = resolve(attachSel);
+ const input = resolve(inputSel);
+ const picker = resolve(pickerSel);
+ const boxCentre = (el: HTMLElement): number => {
+ const rect = el.getBoundingClientRect();
+ return rect.top + rect.height / 2;
+ };
+ const lineCentre = (el: HTMLElement): number => {
+ const rect = el.getBoundingClientRect();
+ const style = getComputedStyle(el);
+ return (
+ rect.top +
+ Number.parseFloat(style.paddingTop) +
+ Number.parseFloat(style.lineHeight) / 2
+ );
+ };
+ const centres = [boxCentre(attach), lineCentre(input), boxCentre(picker)];
+ return Math.max(...centres) - Math.min(...centres);
+ },
+ { attachSel: ATTACH, inputSel: COMPOSER_INPUT, pickerSel: PICKER },
+ ),
+ { message: WHY, timeout: SETTLE_TIMEOUT_MS },
+ )
+ .toBeLessThanOrEqual(CENTRE_TOLERANCE_PX);
+ });
+});
diff --git a/packages/app/tsconfig.json b/packages/app/tsconfig.json
index 0ec2d12d5..e8c2f8ece 100644
--- a/packages/app/tsconfig.json
+++ b/packages/app/tsconfig.json
@@ -60,6 +60,7 @@
"*.ts",
"tests/stress/fixtures",
"tests/half-open-forced-close.test-helper.ts",
+ "tests/stress/_helpers/acp-catalog.ts",
"tests/stress/_helpers/image.ts",
"tests/stress/_helpers/theme-fade.ts"
],