Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chore(agents): align Home agent composer with Agents new conversation (#6644)

Wolf Mermelstein6c2b9e058d10
diff --git a/apps/web/src/features/inbox-view/components/HomeChatStart.test.tsx b/apps/web/src/features/inbox-view/components/HomeChatStart.test.tsx
new file mode 100644
index 0000000000..fa92401b32
--- /dev/null
+++ b/apps/web/src/features/inbox-view/components/HomeChatStart.test.tsx
@@ -0,0 +1,95 @@
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import type { JSX } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { HomeChatStart } from './HomeChatStart';
+
+type ChildrenProps = { children?: JSX.Element };
+
+const mocks = vi.hoisted(() => ({
+ agentsEnabled: true,
+ asideCollapsed: false,
+ asideOverlay: false,
+}));
+
+vi.mock('@app/components/view-shell', () => ({
+ useViewShell: () => ({
+ aside: {
+ isCollapsed: () => mocks.asideCollapsed,
+ isOverlay: () => mocks.asideOverlay,
+ },
+ }),
+ ViewShell: {
+ TopBar: (props: ChildrenProps) => (
+ <div data-testid="home-topbar">{props.children}</div>
+ ),
+ },
+ ViewSidebar: {
+ Title: (props: ChildrenProps) => <span>{props.children}</span>,
+ },
+}));
+vi.mock('@app/lib/analytics/posthog', () => ({
+ useFeatureFlag: () => () => ({ enabled: mocks.agentsEnabled }),
+}));
+vi.mock('@core/constant/featureFlags', () => ({ enableChatV3Agents: {} }));
+vi.mock('@core/component/AI/component/DragDrop', () => ({
+ DragDropWrapper: (props: ChildrenProps & { class?: string }) => (
+ <div data-testid="home-composer-frame" class={props.class}>
+ {props.children}
+ </div>
+ ),
+}));
+vi.mock('@core/component/AI/context', () => ({
+ ChatInputProvider: (props: ChildrenProps) => props.children,
+}));
+vi.mock('../../home/home-chat-input', () => ({
+ HomeChatInput: () => <div data-testid="home-chat-input" />,
+}));
+vi.mock('../../home/components/home-recommended-actions', () => ({
+ HomeRecommendedActions: () => <div data-testid="home-suggestions" />,
+}));
+
+beforeEach(() => {
+ mocks.agentsEnabled = true;
+ mocks.asideCollapsed = false;
+ mocks.asideOverlay = false;
+});
+afterEach(cleanup);
+
+describe('Home agent composer alignment', () => {
+ it('matches the Agents new-conversation topbar and padding when the list is open', () => {
+ render(() => <HomeChatStart />);
+ const grid = document.querySelector('[data-home-composer-align="agents"]');
+ expect(grid).toBeTruthy();
+ expect(grid?.className).toContain('pt-6');
+ expect(grid?.className).toContain('pb-16');
+ expect(
+ document.querySelector('[data-home-composer-topbar-align]')
+ ).toBeTruthy();
+ expect(document.querySelector('[data-testid="home-topbar"]')).toBeNull();
+ });
+
+ it('uses the real Home topbar instead of a spacer when the list is collapsed', () => {
+ mocks.asideCollapsed = true;
+ render(() => <HomeChatStart />);
+ expect(document.querySelector('[data-testid="home-topbar"]')).toBeTruthy();
+ expect(
+ document.querySelector('[data-home-composer-topbar-align]')
+ ).toBeNull();
+ expect(
+ document.querySelector('[data-home-composer-align="agents"]')
+ ).toBeTruthy();
+ });
+
+ it('keeps the legacy 32px-above-center composer when agents are disabled', () => {
+ mocks.agentsEnabled = false;
+ render(() => <HomeChatStart />);
+ const grid = document.querySelector('[data-home-composer-align="legacy"]');
+ expect(grid).toBeTruthy();
+ expect(grid?.className).toContain('pb-16');
+ expect(grid?.className).not.toContain('pt-6');
+ expect(
+ document.querySelector('[data-home-composer-topbar-align]')
+ ).toBeNull();
+ expect(screen.getByText('What should we get done in Macro?')).toBeTruthy();
+ });
+});
diff --git a/apps/web/src/features/inbox-view/components/HomeChatStart.tsx b/apps/web/src/features/inbox-view/components/HomeChatStart.tsx
index 2b058c19b1..d1ef115232 100644
--- a/apps/web/src/features/inbox-view/components/HomeChatStart.tsx
+++ b/apps/web/src/features/inbox-view/components/HomeChatStart.tsx
@@ -15,29 +15,58 @@ import { HomeChatInput } from '../../home/home-chat-input';
export function HomeChatStart() {
const shell = useViewShell();
const agents = useFeatureFlag(enableChatV3Agents);
+ const showHomeTopBar = () =>
+ shell.aside.isCollapsed() || shell.aside.isOverlay();
return (
<ChatInputProvider>
- <Show when={shell.aside.isCollapsed() || shell.aside.isOverlay()}>
+ <Show when={showHomeTopBar()}>
<ViewShell.TopBar>
<ViewSidebar.Title>Home</ViewSidebar.Title>
</ViewShell.TopBar>
</Show>
- <DragDropWrapper class="relative size-full min-h-0 min-w-0 overflow-y-auto px-6">
- <div class="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">
- <div class="self-end">
- <Show when={!agents().enabled}>
- <h1 class="mb-6 min-h-0 min-w-0 self-end text-center text-2xl font-normal leading-[42px] text-ink">
- What should we get done in Macro?
- </h1>
- </Show>
- </div>
- <HomeChatInput
- variant="default"
- placeholder="Type @ to reference / for skills"
- autoFocusOnMount={false}
- />
- <div class="min-h-0 min-w-0 pb-8">
- <HomeRecommendedActions />
+ <DragDropWrapper class="relative min-h-0 min-w-0 flex-1 overflow-y-auto px-6">
+ <div
+ class={
+ agents().enabled
+ ? 'flex h-full min-h-0 min-w-0 flex-col'
+ : 'h-full min-h-0 min-w-0'
+ }
+ >
+ {/*
+ Agents new conversation sits under ViewShell.TopBar (h-12) and
+ centers with .newchat padding 24/64. Home only renders that bar
+ when the list is collapsed, so reserve the same offset here.
+ */}
+ <Show when={agents().enabled && !showHomeTopBar()}>
+ <div
+ class="h-12 shrink-0"
+ aria-hidden="true"
+ data-home-composer-topbar-align=""
+ />
+ </Show>
+ <div
+ class={
+ 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 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'}
+ >
+ <div class="self-end">
+ <Show when={!agents().enabled}>
+ <h1 class="mb-6 min-h-0 min-w-0 self-end text-center text-2xl font-normal leading-[42px] text-ink">
+ What should we get done in Macro?
+ </h1>
+ </Show>
+ </div>
+ <HomeChatInput
+ variant="default"
+ placeholder="Type @ to reference / for skills"
+ autoFocusOnMount={false}
+ />
+ <div class="min-h-0 min-w-0 pb-8">
+ <HomeRecommendedActions />
+ </div>
</div>
</div>
</DragDropWrapper>
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index 4cf5573897..70d4ef899b 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -130,7 +130,11 @@ hover states use the same semantic colors as other app surfaces.
Type in “Type @ to reference / for skills”, use the attachment button for
attachments and the model menu to choose a model, then press Enter or Send to
create and open an AI chat. If chat creation fails, the submitted text and attachments
-are restored, including before a chat-limit paywall opens. The input stays 32px above the vertical center as suggestions load. Up to three cached AI
+are restored, including before a chat-limit paywall opens. With agents disabled,
+the input stays 32px above the vertical center as suggestions load. With agents
+enabled, the composer uses the same topbar offset and 24/64 padding as the
+Agents new-conversation page so the two inputs share a baseline; suggestions
+still load below it without moving the input. Up to three cached AI
suggestions appear below the
composer, using the existing fast/smart recommendation projections. Compact rows
use one line: reason — Phosphor icon and item name, followed by Open, all at the same font size. Clicking a