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
refactor(home): keep Home open when starting new agent sessions (#7666)
Jacob Beckerman0df5ab59cf8a
diff --git a/apps/web/src/features/home/home-agent-composer.test.tsx b/apps/web/src/features/home/home-agent-composer.test.tsxindex 12edd8e173..95517eb5bb 100644--- a/apps/web/src/features/home/home-agent-composer.test.tsx+++ b/apps/web/src/features/home/home-agent-composer.test.tsx@@ -13,6 +13,7 @@ import { HomeAgentComposer } from './home-agent-composer';const mocks = vi.hoisted(() => ({start: vi.fn(() => 'pending-session'),replace: vi.fn(),+ openPreview: vi.fn(() => true),buildPrompt: vi.fn(),failure: vi.fn(),pendingDraft: () => null as string | null,@@ -22,6 +23,9 @@ const mocks = vi.hoisted(() => ({vi.mock('@app/features/block-agent/context/pending-session', () => ({startPendingSession: mocks.start,}));+vi.mock('./home-view-context', () => ({+ useHomeView: () => ({ openPreview: mocks.openPreview }),+}));vi.mock('@core/context/user', () => ({useUserId: () => () => 'viewer-1',}));@@ -78,7 +82,7 @@ beforeEach(() => {});afterEach(cleanup);-it('forwards the shared composer selection into the common session flow', () => {+it('opens the new session inside Home', () => {render(() => <HomeAgentComposer />);const start = {prompt: 'Build it',@@ -94,9 +98,12 @@ it('forwards the shared composer selection into the common session flow', () =>userId: 'viewer-1',submitSurface: 'home',});- expect(mocks.replace).toHaveBeenCalledWith({- next: { type: 'component', id: 'agents-session~agents~pending-session' },+ // The session opens in Home's detail pane instead of replacing Home.+ expect(mocks.openPreview).toHaveBeenCalledWith({+ type: 'agent_session',+ id: 'pending-session',});+ expect(mocks.replace).not.toHaveBeenCalled();});it('puts suggested context into the shared draft', async () => {diff --git a/apps/web/src/features/home/home-agent-composer.tsx b/apps/web/src/features/home/home-agent-composer.tsxindex 5f4de36b91..ac7464e98d 100644--- a/apps/web/src/features/home/home-agent-composer.tsx+++ b/apps/web/src/features/home/home-agent-composer.tsx@@ -9,9 +9,6 @@ import { TOKENS } from '@core/hotkey/tokens';import { useWarmAgentSessionQuery } from '@queries/agent-session/warm';import { createEffect, onCleanup } from 'solid-js';import '../agents-view/agents-view.css';-import { modeForKind } from '../agents-view/core/agent-kind';-import { kindForBot } from '../agents-view/core/roster';-import { agentsRouteId } from '../agents-view/core/route';import {createPersistedComposerDraft,HOME_CONVERSATION_DRAFT_KEY,@@ -21,11 +18,13 @@ import {NewChatPage,type StartConversation,} from '../agents-view/views/NewChatPage';+import { useHomeView } from './home-view-context';import { buildHomeAgentPrompt } from './queries/home-agent-prompt';-/** Home supplies suggestions and navigation to the same composer used by Agents. */+/** Home supplies suggestions and its detail pane to the same composer used by Agents. */export function HomeAgentComposer(props: { autoFocus?: boolean }) {const panel = useSplitPanelOrThrow();+ const home = useHomeView();const input = useChatInputContext();const roster = createAgentRosterSource();const settings = useSettingsState();@@ -79,21 +78,15 @@ export function HomeAgentComposer(props: { autoFocus?: boolean }) {return true;},});+ // The session opens in Home's detail pane rather than Agents; its row joins+ // the Home list once the create answers.const start = (conversation: StartConversation) => {const id = startPendingSession({...conversation,userId: userId(),submitSurface: 'home',});- panel.handle.replace({- next: {- type: 'component',- id: agentsRouteId({- mode: modeForKind(kindForBot(conversation.botId, roster.roster())),- conversation: { type: 'agent_session', id },- }),- },- });+ home.openPreview({ type: 'agent_session', id });};return (<div class="agents-view-portal min-w-0 [&_.newchat]:p-0">diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.mdindex 48ceb737f7..b1dd2f3c2d 100644--- a/docs/AGENT_GUIDE/ai-chat.md+++ b/docs/AGENT_GUIDE/ai-chat.md@@ -572,7 +572,9 @@ file or a guessed remote revision.Home's composer follows the existing `enable-chat-v3-agents` flag: disabled keepslegacy chat; enabled mounts the same new-conversation composer as the Agents page.The greeting, agent/model selector, coding repository/branch drawer, and send flow-are shared. Sending opens the new session inside Agents with the matching URL.+are shared. Sending stays on Home and opens the new session in Home's detail+pane (`/home/agent/<id>`) with the first prompt shown as sent; its row joins the+top of the Home list once the session is created.Home suggestions and document/project context populate this same draft as markdownmentions. A failed suggestion conversion preserves the text and shows an error.Session creation and prompt delivery use the shared pending-session flow.