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(agents): chat direction (#6714)
Eric Hayesb54797fa04a4
diff --git a/apps/web/src/features/agents-view/components/ChatComposer.tsx b/apps/web/src/features/agents-view/components/ChatComposer.tsxindex 07000cfa9e..3e11ec9431 100644--- a/apps/web/src/features/agents-view/components/ChatComposer.tsx+++ b/apps/web/src/features/agents-view/components/ChatComposer.tsx@@ -207,20 +207,28 @@ export function ChatComposer(props: {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]">- <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:self-stretch 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)- }- />+ <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}>+ <Input.AttachFilesAction+ accept={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)+ }+ />+ </div></div><divdata-composer-controls@@ -229,12 +237,6 @@ export function ChatComposer(props: {aria-label="Composer settings"><div class="ml-auto flex min-w-0 max-w-full items-center gap-2 [&_.menu]:right-0 [&_.menu]:left-auto [&_.menu-anchor]:min-w-0 [&_.pill]:max-w-full">- <Show when={props.onAttachFiles}>- <Input.AttachFilesAction- accept={null}- disabled={disabled()}- />- </Show>{props.selector}<Showwhen={diff --git a/apps/web/src/features/block-agent/component/Transcript.test.tsx b/apps/web/src/features/block-agent/component/Transcript.test.tsxindex 243db52805..7db69000be 100644--- a/apps/web/src/features/block-agent/component/Transcript.test.tsx+++ b/apps/web/src/features/block-agent/component/Transcript.test.tsx@@ -372,13 +372,13 @@ describe('Transcript with the shared TanStack ThreadList', () => {expect(view.scroller.scrollTop).toBe(view.scroller.scrollHeight - viewport);});- it('bottom-aligns a short transcript inside mobile insets and preserves selection wiring', async () => {+ it('top-aligns a short transcript inside mobile insets and preserves selection wiring', async () => {session.touch = true;const view = mount([message(0)]);await settle();const row = view.container.querySelector<HTMLElement>('[data-index="0"]')!;expect(row.style.transform).toBe(- 'translateY(calc(224px - var(--channel-scroll-adjustment, 0px)))'+ 'translateY(calc(56px - var(--channel-scroll-adjustment, 0px)))');expect(view.scroller.scrollTop).toBe(0);const reply = view.getByText('Reply to selection');@@ -387,7 +387,7 @@ describe('Transcript with the shared TanStack ThreadList', () => {expect(session.quoteSelection).toHaveBeenCalledWith('selected text');});- it('uses the channel header inset without a fixed-pixel decorative gap', async () => {+ it('adds top padding after the floating header inset', async () => {session.touch = true;rowHeight = 500;const view = mount([message(0)]);@@ -396,9 +396,9 @@ describe('Transcript with the shared TanStack ThreadList', () => {await settle();const row = view.container.querySelector<HTMLElement>('[data-index="0"]')!;expect(row.style.transform).toBe(- 'translateY(calc(40px - var(--channel-scroll-adjustment, 0px)))'+ 'translateY(calc(56px - var(--channel-scroll-adjustment, 0px)))');- expect(view.scroller.scrollHeight).toBe(40 + 500 + 80);+ expect(view.scroller.scrollHeight).toBe(56 + 500 + 80);});it('keeps a mounted row and its selection when its message object is replaced', async () => {diff --git a/apps/web/src/features/block-agent/component/Transcript.tsx b/apps/web/src/features/block-agent/component/Transcript.tsxindex 2d469f0967..462c8e16d3 100644--- a/apps/web/src/features/block-agent/component/Transcript.tsx+++ b/apps/web/src/features/block-agent/component/Transcript.tsx@@ -1,4 +1,4 @@-/** Agent messages on the channel's end-anchored TanStack scroll surface. */+/** Top-aligned agent messages with end-following for overflowing transcripts. */import { ScrollToBottomOverlay } from '@channel/Channel/ScrollToBottomOverlay';import {ThreadList,@@ -110,15 +110,16 @@ export function Transcript(props: { searchTarget?: AgentMessageTarget }) {const insets = () =>isTouchDevice()? {- start: splitPanel?.contentOffsetTop() ?? 0,+ start: (splitPanel?.contentOffsetTop() ?? 0) + 16,end: FloatRegions.hostHeight(),}- : { start: 0, end: 0 };+ : { start: 16, end: 0 };return (<div class="relative flex-1 min-h-0" ref={setTranscriptEl}><ThreadListkeys={keys}+ shortListAlign="start"initialPosition={initialTarget && initialSessionId? {diff --git a/apps/web/src/features/channel/Channel/ThreadList.tsx b/apps/web/src/features/channel/Channel/ThreadList.tsxindex 0d224448a5..76a48c802c 100644--- a/apps/web/src/features/channel/Channel/ThreadList.tsx+++ b/apps/web/src/features/channel/Channel/ThreadList.tsx@@ -89,6 +89,8 @@ type ThreadListProps = {) => void;/** Follow live messages only when the loaded window includes the latest page. */followOnAppend?: boolean;+ /** Position messages when they do not fill the viewport. Defaults to end. */+ shortListAlign?: 'start' | 'end';/** Keep this thread mounted while its message or reply is being positioned. */targetId?: string;/**@@ -365,7 +367,9 @@ export function ThreadList(props: ThreadListProps) {}const shortListOffset = () =>- Math.max(0, viewportSize() - virtualizer.getTotalSize());+ props.shortListAlign === 'start'+ ? 0+ : Math.max(0, viewportSize() - virtualizer.getTotalSize());// The adapter mutates its store by index. Snapshot those values and let Key// own each row's accessor by message ID, including while a row is removed.// A lookup into a shared map can disappear before queued row effects run.diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.mdindex 0af079e84a..d33e9122ee 100644--- a/docs/AGENT_GUIDE/ai-chat.md+++ b/docs/AGENT_GUIDE/ai-chat.md@@ -30,8 +30,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 takes the full width and controls move below;- returning to a short paragraph restores the compact row. Height changes animate+ 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 animateover 150ms, 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.@@ -462,8 +463,10 @@ The pane does not create PRs or generate their descriptions.Agent sessions reuse the channel's TanStack `ThreadList`. Opening a session landsat the latest message, including when history arrives after the empty view. Short-transcripts sit at the bottom, above the composer. Only the visible rows and an-overscan buffer are mounted: scroll to older turns before searching their DOM text.+transcripts start with 16px of top padding, with the user prompt followed by the+agent response; streaming output grows downward into the available space. Only+the visible rows and an overscan buffer are mounted: scroll to older turns before+searching their DOM text.Search links add `agent_message_turn=<zero-based turn>&agent_message_author=user|agent`.They wait for history to load, then scroll to and highlight the matching folded