Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix: refine coding agent composer (#6756)
teoe672ee3ff3b0
diff --git a/apps/web/src/features/agents-view/agents-view.css b/apps/web/src/features/agents-view/agents-view.cssindex cd986f7e22..b2905e90bb 100644--- a/apps/web/src/features/agents-view/agents-view.css+++ b/apps/web/src/features/agents-view/agents-view.css@@ -304,9 +304,23 @@gap: 20px;}+ /* Anchor the greeting independently of the draft and repository bar height. */+ .agents-view .newchat[data-active] {+ display: grid;+ grid-template-columns: minmax(0, 1fr);+ grid-template-rows: max(0px, calc(50% - 60px)) auto 1fr;+ justify-items: center;+ align-items: start;+ gap: 0;+ }++ .agents-view .newchat > .col {+ grid-row: 2;+ }+:where(.agents-view, .agents-view-portal) .newchat .col {width: 100%;- max-width: 768px;+ max-width: 720px;display: flex;flex-direction: column;gap: 20px;@@ -327,12 +341,27 @@}:where(.agents-view, .agents-view-portal) .composer-drawer {+ position: relative;display: grid;grid-template-rows: 0fr;- margin: 0 20px;+ margin: 0 16px;+ border-radius: 20px 20px 0 0;+ background: color-mix(in oklch, var(--surface-1) 40%, var(--surface-2));opacity: 0;visibility: hidden;- transition: grid-template-rows 240ms ease, opacity 180ms ease, visibility 240ms;+ transition: grid-template-rows 200ms cubic-bezier(0.77, 0, 0.175, 1), opacity 200ms cubic-bezier(0.23, 1, 0.32, 1), visibility 200ms;+ }++ /* Continue the bar behind the input's rounded top corners. */+ :where(.agents-view, .agents-view-portal) .composer-drawer::after {+ content: '';+ position: absolute;+ top: 100%;+ left: 0;+ right: 0;+ height: 32px;+ background: inherit;+ pointer-events: none;}:where(.agents-view, .agents-view-portal) .composer-drawer[data-open] {@@ -343,19 +372,15 @@:where(.agents-view, .agents-view-portal) .composer-drawer-inner {min-height: 0;+ overflow: hidden;}:where(.agents-view, .agents-view-portal) .composer-drawer-content {display: flex;align-items: center;- margin-top: -32px;- padding: 42px 12px 10px;- border-radius: 0 0 20px 20px;- background: var(--surface-2);- border: var(--hair) solid var(--edge-muted);- border-top: 0;- transform: translateY(-12px);- transition: transform 240ms ease;+ padding: 2px 10px;+ transform: translateY(12px);+ transition: transform 200ms cubic-bezier(0.77, 0, 0.175, 1);}:where(.agents-view, .agents-view-portal) .composer-drawer[data-open] .composer-drawer-content {diff --git a/apps/web/src/features/agents-view/components/ChatComposer.test.tsx b/apps/web/src/features/agents-view/components/ChatComposer.test.tsxindex 3a6dac7a6f..8d49324459 100644--- a/apps/web/src/features/agents-view/components/ChatComposer.test.tsx+++ b/apps/web/src/features/agents-view/components/ChatComposer.test.tsx@@ -195,7 +195,7 @@ describe('Chat session input', () => {expect(screen.getByRole('button', { name: 'Agent' })).toBeTruthy();expect(screen.queryByRole('button', { name: 'Model' })).toBeNull();});- it('reveals the repository drawer without remounting the editor', () => {+ it('expands coding mode above the input without remounting the editor', () => {const [mode, setMode] = createSignal('chat');const { container } = render(() => (<ChatComposer@@ -209,13 +209,23 @@ describe('Chat session input', () => {));const input = screen.getByTestId('editor');const drawer = container.querySelector('.composer-drawer');+ const layout = container.querySelector('[data-composer-compact]');+ expect(layout?.getAttribute('data-composer-compact')).toBe('true');+ expect(+ (drawer?.compareDocumentPosition(input) ?? 0) &+ Node.DOCUMENT_POSITION_FOLLOWING+ ).toBeTruthy();expect((drawer as HTMLElement).inert).toBe(true);expect(drawer?.getAttribute('aria-hidden')).toBe('true');setMode('code');expect(screen.getByTestId('editor')).toBe(input);expect((drawer as HTMLElement).inert).toBe(false);expect(drawer?.hasAttribute('data-open')).toBe(true);+ expect(layout?.getAttribute('data-composer-compact')).toBe('false');+ expect(editor.clear).not.toHaveBeenCalled();setMode('chat');+ expect(layout?.getAttribute('data-composer-compact')).toBe('true');+ expect(screen.getByTestId('editor')).toBe(input);expect((drawer as HTMLElement).inert).toBe(true);const settings = screen.getByRole('group', { name: 'Composer settings' });expect(settings.textContent).toBe('Agent');diff --git a/apps/web/src/features/agents-view/components/ChatComposer.tsx b/apps/web/src/features/agents-view/components/ChatComposer.tsxindex 7857d22886..e0bcbce79c 100644--- a/apps/web/src/features/agents-view/components/ChatComposer.tsx+++ b/apps/web/src/features/agents-view/components/ChatComposer.tsx@@ -9,6 +9,7 @@ import { isTouchDevice } from '@core/mobile/isTouchDevice';import { useTouchOutsideToDismissKeyboard } from '@core/mobile/useTouchOutsideToDismissKeyboard';import { handleFileFolderDrop } from '@core/util/upload';import { $insertReferencedPaste } from '@macro-inc/lexical-core';+import PlusIcon from '@phosphor/plus.svg';import { createResizeObserver } from '@solid-primitives/resize-observer';import { Button, ComposerSurface, SendButton } from '@ui';import {@@ -179,10 +180,28 @@ export function ChatComposer(props: {}}><div ref={container} data-keep-keyboard class="min-w-0">+ <Show when={props.drawer}>+ <div+ class="composer-drawer"+ data-open={props.drawerOpen ? '' : undefined}+ aria-hidden={!props.drawerOpen}+ inert={!props.drawerOpen}+ >+ <div class="composer-drawer-inner">+ <div+ class="composer-drawer-content"+ role="group"+ aria-label="Repository settings"+ >+ {props.drawer}+ </div>+ </div>+ </div>+ </Show><ComposerSurfaceas="div"data-agent-composer="chat"- class="relative z-10 min-w-0 rounded-[32px] transition-[height] duration-150 ease-out motion-reduce:transition-none"+ class="relative z-10 min-w-0 rounded-[32px] transition-[height] duration-200 ease-[cubic-bezier(0.77,0,0.175,1)] motion-reduce:transition-none"style={{height: height() === undefined ? undefined : `${height()}px`,}}@@ -204,35 +223,41 @@ export function ChatComposer(props: {<Input.Attachments kind="document" class="pb-0" /><divref={setLayout}- data-composer-compact={isCompact()}- class="group/composer flex min-w-0 data-[composer-compact=false]:flex-col data-[composer-compact=false]:items-stretch items-end gap-2 p-[7.5px]"+ data-composer-compact={!props.drawerOpen && isCompact()}+ data-composer-coding={props.drawerOpen || undefined}+ class="group/composer flex min-w-0 data-[composer-compact=false]:flex-wrap items-end gap-2 p-[7.5px] pl-3 data-[composer-compact=false]:pb-2.5 data-[composer-compact=false]:px-3 data-[composer-coding=true]:pt-4">- <div class="flex min-w-0 flex-1 self-center items-start group-data-[composer-compact=false]/composer:flex-none group-data-[composer-compact=false]/composer:self-stretch">- <Show when={props.onAttachFiles}>+ <Show when={props.onAttachFiles}>+ <div+ data-composer-controls+ class="shrink-0 group-data-[composer-compact=false]/composer:order-1"+ ><Input.AttachFilesActionaccept={null}disabled={disabled()}- />- </Show>- <div class="max-h-60 min-w-0 flex-1 self-center overflow-y-auto px-[9.375px]">- <MarkdownShell- class="h-auto min-h-6 text-base leading-6 [&_[data-markdown-editable]]:min-h-6 [&_[data-markdown-editable]]:outline-none [&_[data-markdown-editable]>.md-p]:my-0 [&_[data-markdown-placeholder]]:max-w-full [&_[data-markdown-placeholder]>p]:m-0 [&_[data-markdown-placeholder]>p]:truncate"- config={editor}- initialValue={props.draft}- placeholder={props.placeholder ?? tip()}- refFn={(element) =>- element.setAttribute('aria-label', 'Message the agent')- }- autofocus={- !isTouchDevice() &&- (props.autoFocus ?? props.session?.autofocus ?? true)- }- />+ >+ <PlusIcon />+ </Input.AttachFilesAction></div>+ </Show>+ <div class="max-h-60 min-w-0 flex-1 self-center group-data-[composer-compact=false]/composer:flex-none group-data-[composer-compact=false]/composer:basis-full overflow-y-auto px-[9.375px] group-data-[composer-compact=true]/composer:px-0 group-data-[composer-coding=true]/composer:min-h-[58px]">+ <MarkdownShell+ class="h-auto min-h-6 text-base leading-6 [&_[data-markdown-editable]]:min-h-6 [&_[data-markdown-editable]]:outline-none [&_[data-markdown-editable]>.md-p]:my-0 [&_[data-markdown-placeholder]]:max-w-full [&_[data-markdown-placeholder]>p]:m-0 [&_[data-markdown-placeholder]>p]:truncate"+ config={editor}+ initialValue={props.draft}+ placeholder={props.placeholder ?? tip()}+ refFn={(element) =>+ element.setAttribute('aria-label', 'Message the agent')+ }+ autofocus={+ !isTouchDevice() &&+ (props.autoFocus ?? props.session?.autofocus ?? true)+ }+ /></div><divdata-composer-controls- class="flex min-w-0 max-w-[55%] group-data-[composer-compact=false]/composer:max-w-none shrink-0 items-center"+ class="order-2 flex min-w-0 max-w-[55%] group-data-[composer-compact=false]/composer:max-w-none group-data-[composer-compact=false]/composer:flex-1 shrink-0 items-center gap-2"role="group"aria-label="Composer settings">@@ -287,24 +312,6 @@ export function ChatComposer(props: {</div></Input.DropZone></ComposerSurface>- <Show when={props.drawer}>- <div- class="composer-drawer"- data-open={props.drawerOpen ? '' : undefined}- aria-hidden={!props.drawerOpen}- inert={!props.drawerOpen}- >- <div class="composer-drawer-inner">- <div- class="composer-drawer-content"- role="group"- aria-label="Repository settings"- >- {props.drawer}- </div>- </div>- </div>- </Show></div></InputProvider>);diff --git a/apps/web/src/features/agents-view/views/RepositoryPicker.tsx b/apps/web/src/features/agents-view/views/RepositoryPicker.tsxindex d2fc752c62..0eb9e73877 100644--- a/apps/web/src/features/agents-view/views/RepositoryPicker.tsx+++ b/apps/web/src/features/agents-view/views/RepositoryPicker.tsx@@ -1,6 +1,7 @@import { Popover } from '@kobalte/core/popover';import CaretDownIcon from '@phosphor/caret-down.svg';import CheckIcon from '@phosphor/check.svg';+import FolderIcon from '@phosphor/folder-simple.svg';import GitBranchIcon from '@phosphor/git-branch.svg';import GithubIcon from '@phosphor/github-logo.svg';import { Button, createCommandListController } from '@ui';@@ -168,7 +169,7 @@ export function RepositoryPicker(props: {offeredBranches().length === 0 &&!branchSearch().trim();return (- <div class="flex min-w-0 flex-wrap items-center gap-2">+ <div class="flex min-w-0 w-full items-center gap-2"><Popoveropen={repoOpen()}onOpenChange={(open) => {@@ -182,8 +183,11 @@ export function RepositoryPicker(props: {placement="top-start"gutter={8}>- <Popover.Trigger class="pill max-w-full" aria-label="Repository">- <GithubIcon class="size-4 shrink-0" />+ <Popover.Trigger+ class="pill min-w-0 max-w-full text-ink"+ aria-label="Repository"+ >+ <FolderIcon class="size-4 shrink-0" /><span class="truncate">{props.repoUrl? repositoryLabel(props.repoUrl)@@ -327,7 +331,10 @@ export function RepositoryPicker(props: {placement="top-start"gutter={8}>- <Popover.Trigger class="pill max-w-full" aria-label="Branch">+ <Popover.Trigger+ class="pill min-w-0 max-w-[45%] text-ink"+ aria-label="Branch"+ ><GitBranchIcon class="size-4 shrink-0" /><span class="truncate">{props.branch}</span><CaretDownIcon class="size-3 shrink-0" />diff --git a/apps/web/src/features/channel/Input/InputActions.tsx b/apps/web/src/features/channel/Input/InputActions.tsxindex 045c1d4352..8cb0e40788 100644--- a/apps/web/src/features/channel/Input/InputActions.tsx+++ b/apps/web/src/features/channel/Input/InputActions.tsx@@ -16,7 +16,11 @@ import { useInput, useInputCommands } from './context';* to accept whatever it would accept on a drop.*/export function AttachFilesAction(- props: { accept?: string | null; disabled?: boolean } = {}+ props: {+ accept?: string | null;+ disabled?: boolean;+ children?: JSX.Element;+ } = {}) {const commands = useInputCommands();let fileInputRef: HTMLInputElement | undefined;@@ -53,7 +57,7 @@ export function AttachFilesAction(disabled={props.disabled}onClick={() => fileInputRef?.click()}>- <PaperclipIcon />+ {props.children ?? <PaperclipIcon />}</InputActionButton></>);diff --git a/apps/web/src/features/inbox-view/components/HomeChatStart.tsx b/apps/web/src/features/inbox-view/components/HomeChatStart.tsxindex d1ef115232..59027ca473 100644--- a/apps/web/src/features/inbox-view/components/HomeChatStart.tsx+++ b/apps/web/src/features/inbox-view/components/HomeChatStart.tsx@@ -34,7 +34,7 @@ export function HomeChatStart() {>{/*Agents new conversation sits under ViewShell.TopBar (h-12) and- centers with .newchat padding 24/64. Home only renders that bar+ anchors the greeting with .newchat padding 24/64. Home only renders that barwhen the list is collapsed, so reserve the same offset here.*/}<Show when={agents().enabled && !showHomeTopBar()}>@@ -47,7 +47,7 @@ export function HomeChatStart() {<divclass={agents().enabled- ? 'mx-auto grid min-h-64 min-w-0 w-full max-w-180 flex-1 grid-cols-1 grid-rows-[1fr_auto_1fr] pt-6 pb-16'+ ? 'mx-auto grid min-h-64 min-w-0 w-full max-w-180 flex-1 grid-cols-1 grid-rows-[max(0px,calc(50%-60px))_auto_1fr] pt-6 pb-16': 'mx-auto grid h-full min-h-64 min-w-0 w-full max-w-180 grid-cols-1 grid-rows-[1fr_auto_1fr] pb-16'}data-home-composer-align={agents().enabled ? 'agents' : 'legacy'}diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.mdindex 815dbfd582..e60cb79797 100644--- a/docs/AGENT_GUIDE/ai-chat.md+++ b/docs/AGENT_GUIDE/ai-chat.md@@ -36,10 +36,9 @@- The starting page has a compact composer that starts at one line and growswith longer prompts or Shift+Enter. Lists, quotes, headings, and othernon-paragraph blocks expand immediately, even with short text. This also applies- to session composers. The editor row takes the full width and controls move below.- The paperclip sits to the left of the editor in both layouts.- Returning to a short paragraph restores the compact row. Height changes animate- over 150ms, with reduced-motion preferences respected. **Agent** and **Send**+ to session composers. The editor takes the full width and controls move below;+ returning to a short paragraph restores the compact row. Height changes animate+ over 200ms, with reduced-motion preferences respected. **Agent** and **Send**sit inside the input on the right.Direct model selections show only the model name and provider icon in the input.Saved and coding agents show their identity beside the current model. There is@@ -70,10 +69,15 @@when changing agents. **Create agent** stays pinned at the bottom of the dropdownwhile the agent and model lists scroll. It opens the roster on the selected kind'stab, where either kind can be created.-- Selecting a coding agent reveals a repository drawer directly under the input- with a short slide and fade; it extends 32px behind the rounded input and stays- behind it throughout the transition, keeping its existing edge-muted border.- Selecting a chat agent retracts it. Reduced-motion+- On Home and New conversation, selecting a coding agent expands the input even+ with an empty or short draft. The heading stays anchored while the composer+ expands downward. The plus attachment button stays at the far left: before the+ text in the compact row, and on the bottom control row when expanded. The editor sits above the controls, with attachments+ on the left and the agent/model and Send on the right. An inset repository bar+ slides and fades in above the rounded input over 200ms, with rounded top corners+ and a darker surface in dark mode. Selecting a chat agent retracts the bar and+ restores the compact input when the draft fits on one line, without remounting+ the editor or losing the draft. Reduced-motionpreferences disable the animation. The hidden drawer is inert. **Repository**(**Choose repository** until one is picked) opens a searchable list:**Choose automatically**, then the repositories the signed-in user reaches