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
feat(agents): Work and Code modes for the Agents workspace (#7636)
Wolf Mermelsteinb82bf27d70f0
diff --git a/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx b/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsxindex a115dfc038..8c083e7f7c 100644--- a/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx+++ b/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx@@ -8,6 +8,7 @@ import {} from '@solidjs/testing-library';import { createSignal, type JSX } from 'solid-js';import { afterEach, describe, expect, it, vi } from 'vitest';+import type { AgentsMode } from '../core/mode';import {type AgentConversationEntity,partitionArchived,@@ -111,7 +112,7 @@ vi.mock('@app/components/view-shell/SidebarCreateButton', () => ({}));describe('mixed Agents sidebar', () => {- it('keeps Chat and Code together, marks each kind, and preserves split navigation', () => {+ it('lists only the conversations of the chosen mode and switches between Work and Code', async () => {const conversations: AgentConversationEntity[] = [{type: 'agent_session',@@ -123,17 +124,30 @@ describe('mixed Agents sidebar', () => {status: 'acp_ready',},{ type: 'chat', id: 'chat', name: 'Plan launch', ownerId: 'me' },+ {+ type: 'agent_session',+ id: 'archived-code',+ name: 'Old spike',+ ownerId: 'me',+ isArchived: true,+ botId: 'cursor',+ status: 'disconnected',+ },];+ const [mode, setMode] = createSignal<AgentsMode>('chat');+ const changeMode = vi.fn(setMode);const open = vi.fn();const create = vi.fn();const openPage = vi.fn();render(() => (<AgentsSidebar+ mode={mode()}+ onModeChange={changeMode}activePage="new"onOpenPage={openPage}{...partitionArchived(conversations)}modeForConversation={(conversation) =>- conversation.id === 'code' ? 'code' : 'chat'+ conversation.type === 'chat' ? 'chat' : 'code'}activeConversationId="chat"search=""@@ -152,26 +166,70 @@ describe('mixed Agents sidebar', () => {fireEvent.click(screen.getByRole('button', { name: label }));expect(openPage).toHaveBeenLastCalledWith(label.toLowerCase());}- expect(screen.queryByRole('tablist')).toBeNull();- const code = screen.getByRole('button', { name: /Fix build/ });++ const work = screen.getByRole('radio', {+ name: 'Work',+ }) as HTMLInputElement;+ expect(work.checked).toBe(true);const chat = screen.getByRole('button', { name: /Plan launch/ });- expect(code.closest('[data-kind]')?.getAttribute('data-kind')).toBe('code');expect(chat.getAttribute('data-kind')).toBe('chat');expect(chat.getAttribute('aria-current')).toBe('page');+ expect(screen.queryByRole('button', { name: /Fix build/ })).toBeNull();+ expect(screen.queryByText('Archived')).toBeNull();+ fireEvent.click(chat);+ expect(open).toHaveBeenLastCalledWith(conversations[1], expect.anything());++ fireEvent.click(screen.getByRole('radio', { name: 'Code' }));+ expect(changeMode).toHaveBeenCalledWith('code');+ const code = await screen.findByRole('button', { name: /Fix build/ });+ expect(code.closest('[data-kind]')?.getAttribute('data-kind')).toBe('code');+ expect(screen.queryByRole('button', { name: /Plan launch/ })).toBeNull();+ expect(screen.getByText('Archived')).toBeTruthy();+ expect(screen.getByRole('button', { name: /Old spike/ })).toBeTruthy();fireEvent.click(code, { shiftKey: true });- expect(open).toHaveBeenCalledWith(+ expect(open).toHaveBeenLastCalledWith(conversations[0],expect.objectContaining({ shiftKey: true }));- fireEvent.click(chat);- expect(open).toHaveBeenLastCalledWith(conversations[1], expect.anything());fireEvent.click(screen.getByRole('button', { name: 'New conversation' }));expect(create).toHaveBeenCalledOnce();});+ it('keeps paging while the chosen mode has too few conversations to scroll', () => {+ const loadMore = vi.fn();+ render(() => (+ <AgentsSidebar+ mode="code"+ onModeChange={vi.fn()}+ activePage="new"+ onOpenPage={vi.fn()}+ conversations={[+ { type: 'chat', id: 'chat', name: 'Plan launch', ownerId: 'me' },+ ]}+ archived={[]}+ modeForConversation={() => 'chat'}+ activeConversationId={undefined}+ search=""+ loading={false}+ error={false}+ hasNextPage+ loadingNextPage={false}+ onNewConversation={vi.fn()}+ onSearchChange={vi.fn()}+ onOpenConversation={vi.fn()}+ onRetry={vi.fn()}+ onLoadMore={loadMore}+ />+ ));+ expect(loadMore).toHaveBeenCalledOnce();+ expect(screen.getByText('No coding conversations yet.')).toBeTruthy();+ });+it('opens rename and delete on a session or chat right-click', async () => {render(() => (<AgentsSidebar+ mode="chat"+ onModeChange={vi.fn()}activePage="new"onOpenPage={vi.fn()}{...partitionArchived([@@ -195,9 +253,7 @@ describe('mixed Agents sidebar', () => {},{ type: 'chat', id: 'chat', name: 'Plan launch', ownerId: 'me' },])}- modeForConversation={(conversation) =>- conversation.id === 'code' ? 'code' : 'chat'- }+ modeForConversation={() => 'chat'}activeConversationId={undefined}search=""loading={false}@@ -274,6 +330,8 @@ describe.each(['home', 'sidebar'] as const)('%s agent rows', (surface) => {/>) : (<AgentsSidebar+ mode="code"+ onModeChange={vi.fn()}activePage="new"onOpenPage={vi.fn()}conversations={[entity()]}diff --git a/apps/web/src/features/agents-view/components/AgentsSidebar.tsx b/apps/web/src/features/agents-view/components/AgentsSidebar.tsxindex 9cb27c261c..65f2199d19 100644--- a/apps/web/src/features/agents-view/components/AgentsSidebar.tsx+++ b/apps/web/src/features/agents-view/components/AgentsSidebar.tsx@@ -28,11 +28,11 @@ import PlugIcon from '@phosphor/plugs-connected.svg';import AgentIcon from '@phosphor/sparkle.svg';import TrayIcon from '@phosphor/tray.svg';import { Key } from '@solid-primitives/keyed';-import { cn } from '@ui';+import { cn, Tabs } from '@ui';import { tourTarget } from '@ui/components/Tour';-import { createSignal, type JSX, Show } from 'solid-js';+import { createEffect, createSignal, type JSX, Show } from 'solid-js';import { compactAge } from '../core/format-age';-import type { AgentsMode } from '../core/mode';+import { type AgentsMode, agentsModeLabel } from '../core/mode';import type { AgentsPage } from '../core/pages';import {type AgentConversationEntity,@@ -42,12 +42,18 @@ import { AGENTS_TOUR } from '../tour';import { AgentSessionListItem } from '../views/AgentSessionListItem';import { AgentSessionListSkeleton } from './AgentSessionListSkeleton';+/** Rows a mode should fill before paging stops waiting for a scroll. */+const MODE_PAGE_FILL = 20;+const AGENTS_ACTION_VIEW_CONTEXT: EntityActionViewContext = {supportsMarkDone: false,senderBucket: undefined,};export type AgentsSidebarProps = {+ /** Only conversations of this mode are listed. */+ mode: AgentsMode;+ onModeChange: (mode: AgentsMode) => void;activePage: AgentsPage | undefined;onOpenPage: (page: AgentsPage) => void;modeForConversation: (conversation: AgentConversationEntity) => AgentsMode;@@ -159,8 +165,14 @@ export function AgentsSidebar(props: AgentsSidebarProps) {const [searchOpen, setSearchOpen] = createSignal(false);const [conversationsOpen, setConversationsOpen] = createSignal(true);let searchInput: HTMLInputElement | undefined;+ const inMode = (conversations: AgentConversationEntity[]) =>+ conversations.filter(+ (conversation) => props.modeForConversation(conversation) === props.mode+ );+ const conversations = () => inMode(props.conversations);+ const archived = () => inMode(props.archived);const actionController = createListController({- items: () => [...props.conversations, ...props.archived],+ items: () => [...conversations(), ...archived()],getKey: (conversation) => conversation.id,isSelectable: () => false,});@@ -168,7 +180,19 @@ export function AgentsSidebar(props: AgentsSidebarProps) {controller: actionController,getEntity: (conversation) => conversation,});- const total = () => props.conversations.length + props.archived.length;+ const total = () => conversations().length + archived().length;+ // Both modes page through one mixed query, so a short filtered list never+ // scrolls far enough to ask for more; keep paging until it fills.+ createEffect(() => {+ if (+ total() < MODE_PAGE_FILL &&+ props.hasNextPage &&+ !props.loading &&+ !props.loadingNextPage &&+ !props.error+ )+ props.onLoadMore();+ });// Both lists page through one query, so either reaching its end loads more.const loadMoreNearEnd = (event: Event & { currentTarget: HTMLElement }) => {const list = event.currentTarget;@@ -230,6 +254,24 @@ export function AgentsSidebar(props: AgentsSidebarProps) {</ViewSidebar.Header></Show>+ <div+ ref={tourTarget(AGENTS_TOUR.modeSwitch)}+ class="px-(--sidebar-gutter) pt-1 touch:pt-0"+ >+ <Tabs+ aria-label="Agents mode"+ fullWidth+ list={(['chat', 'code'] as const).map((mode) => ({+ value: mode,+ label: agentsModeLabel(mode),+ }))}+ value={props.mode}+ onChange={(value) =>+ props.onModeChange(value === 'code' ? 'code' : 'chat')+ }+ />+ </div>+<Show when={!isTouchDevice()}><div class="px-(--sidebar-gutter) pt-2"><SidebarCreateButton@@ -315,7 +357,7 @@ export function AgentsSidebar(props: AgentsSidebarProps) {aria-busy={props.loading || props.loadingNextPage}onScroll={loadMoreNearEnd}>- {rows(() => props.conversations)}+ {rows(conversations)}<Show when={props.loading && total() === 0}><AgentSessionListSkeleton /></Show>@@ -329,7 +371,9 @@ export function AgentsSidebar(props: AgentsSidebarProps) {<p class="px-(--sidebar-item-inset) py-2 text-xs text-ink-muted">{props.search.trim()? `No results for "${props.search.trim()}"`- : 'No conversations yet.'}+ : props.mode === 'code'+ ? 'No coding conversations yet.'+ : 'No conversations yet.'}</p></Show><Show when={props.loadingNextPage}>@@ -338,7 +382,7 @@ export function AgentsSidebar(props: AgentsSidebarProps) {</ViewSidebar.Nav></CollapsibleSection.Content></CollapsibleSection.Root>- <Show when={props.archived.length}>+ <Show when={archived().length}><sectionaria-label="Archived conversations"class="mt-auto flex min-h-0 shrink-0 basis-1/4 flex-col border-t border-edge-muted pt-2"@@ -346,14 +390,14 @@ export function AgentsSidebar(props: AgentsSidebarProps) {<ViewSidebar.Toolbar class="shrink-0"><h3 class="text-xs font-medium text-ink-muted">Archived</h3><span class="text-xs text-ink-extra-muted tabular-nums">- {props.archived.length}+ {archived().length}</span></ViewSidebar.Toolbar><ViewSidebar.Navclass="min-h-0 flex-1 shrink overflow-auto"onScroll={loadMoreNearEnd}>- {rows(() => props.archived)}+ {rows(archived)}</ViewSidebar.Nav></section></Show>diff --git a/apps/web/src/features/agents-view/core/mode.ts b/apps/web/src/features/agents-view/core/mode.tsindex 81d2ecb79c..213815b18f 100644--- a/apps/web/src/features/agents-view/core/mode.ts+++ b/apps/web/src/features/agents-view/core/mode.ts@@ -1,2 +1,7 @@/** Session kind used for routes and the agent workspace's presentation. */export type AgentsMode = 'chat' | 'code';++/** The workspace switch calls chat agents "Work" and coding agents "Code". */+export function agentsModeLabel(mode: AgentsMode): string {+ return mode === 'code' ? 'Code' : 'Work';+}diff --git a/apps/web/src/features/agents-view/primitives/workspace-mode.test.ts b/apps/web/src/features/agents-view/primitives/workspace-mode.test.tsnew file mode 100644index 0000000000..30613e4832--- /dev/null+++ b/apps/web/src/features/agents-view/primitives/workspace-mode.test.ts@@ -0,0 +1,29 @@+import { createRoot } from 'solid-js';+import { beforeEach, describe, expect, it } from 'vitest';+import { createWorkspaceMode } from './workspace-mode';++beforeEach(() => window.localStorage.clear());++describe('workspace mode', () => {+ it('starts in Work and remembers Code per user', () => {+ createRoot((dispose) => {+ const workspace = createWorkspaceMode('user-a');+ expect(workspace.mode()).toBe('chat');+ workspace.setMode('code');+ dispose();+ });+ createRoot((dispose) => {+ expect(createWorkspaceMode('user-a').mode()).toBe('code');+ expect(createWorkspaceMode('user-b').mode()).toBe('chat');+ dispose();+ });+ });++ it('ignores unknown stored values', () => {+ window.localStorage.setItem('agents-view-mode-v1:user-a', 'agents');+ createRoot((dispose) => {+ expect(createWorkspaceMode('user-a').mode()).toBe('chat');+ dispose();+ });+ });+});diff --git a/apps/web/src/features/agents-view/primitives/workspace-mode.ts b/apps/web/src/features/agents-view/primitives/workspace-mode.tsnew file mode 100644index 0000000000..b4174f3d40--- /dev/null+++ b/apps/web/src/features/agents-view/primitives/workspace-mode.ts@@ -0,0 +1,24 @@+import { makePersistedState } from '@app/lib/persistence';+import { createUserScopedStorage } from '@core/util/userScopedStorage';+import { createSignal } from 'solid-js';+import type { AgentsMode } from '../core/mode';++/**+ * Whether the Agents workspace shows chat agents (Work) or coding agents+ * (Code). Scoped to the signed-in user; a new person starts in Work.+ */+export function createWorkspaceMode(userId: string | undefined) {+ const storage = createUserScopedStorage('agents-view-mode-v1');+ const [mode, setMode] = makePersistedState(createSignal<AgentsMode>('chat'), {+ storages: {+ restore: () => {+ if (!userId) return;+ return storage.read(userId) === 'code' ? 'code' : undefined;+ },+ write: (value) => {+ if (userId) storage.write(userId, value);+ },+ },+ });+ return { mode, setMode };+}diff --git a/apps/web/src/features/agents-view/tour.ts b/apps/web/src/features/agents-view/tour.tsindex 08de61e48c..34b036a791 100644--- a/apps/web/src/features/agents-view/tour.ts+++ b/apps/web/src/features/agents-view/tour.ts@@ -4,6 +4,7 @@ import { defineViewTour } from '@app/features/tours/core/view-tour';import { defineTourTargets } from '@ui/components/Tour';export const AGENTS_TOUR = defineTourTargets('agents', [+ 'modeSwitch','newChat','rosterNav','picker',@@ -21,13 +22,21 @@ export const agentsTour = defineViewTour({id: 'agents',title: 'Agents',steps: [+ {+ target: AGENTS_TOUR.modeSwitch,+ entry: [VIEW_SHELL_TOUR.sidebarToggle],+ entryLabel: 'Open the sidebar to continue',+ title: 'Switch between Work and Code',+ description:+ 'Work shows your chat agents and their conversations. Code shows your coding agents, their sessions, and the repository each one works in.',+ },{target: AGENTS_TOUR.picker,entry: [AGENTS_TOUR.newChat, VIEW_SHELL_TOUR.sidebarToggle],entryLabel: 'Start a new conversation to continue',title: 'Choose your agent and model',description:- 'Open this picker to choose a chat or coding agent. Models are listed here too; each agent’s submenu lets you choose a model for that conversation.',+ 'Open this picker to choose an agent for the current mode. In Work, Macro’s models are listed here too; each agent’s submenu lets you choose a model for that conversation.',},{target: AGENTS_TOUR.agentsTab,diff --git a/apps/web/src/features/agents-view/views/AgentsView.tsx b/apps/web/src/features/agents-view/views/AgentsView.tsxindex dd702b46b6..6b0e5d9ba0 100644--- a/apps/web/src/features/agents-view/views/AgentsView.tsx+++ b/apps/web/src/features/agents-view/views/AgentsView.tsx@@ -42,7 +42,7 @@ import { AgentSessionPane } from '../components/AgentSessionPane';import { AgentsSidebar } from '../components/AgentsSidebar';import { Topbar } from '../components/Topbar';import { DataModeProvider, dataModeFor } from '../context/data-mode';-import { type AgentKind, modeForKind } from '../core/agent-kind';+import { type AgentKind, kindForMode, modeForKind } from '../core/agent-kind';import type { AgentsMode } from '../core/mode';import { type AgentsPage, parseAgentsPage } from '../core/pages';import {@@ -54,6 +54,7 @@ import {} from '../core/recent-conversations';import { kindForBot } from '../core/roster';import { type AgentsRoute, agentsRouteId } from '../core/route';+import { createWorkspaceMode } from '../primitives/workspace-mode';import { createAgentRosterSource } from '../queries/agent-roster-source';import { agentsTour } from '../tour';import { NewChatPage, type StartConversation } from './NewChatPage';@@ -82,7 +83,11 @@ function AgentsWorkspace(props: { initialRoute?: AgentsRoute }) {useWarmAgentSessionQuery(userId);const notifications = useGlobalNotificationSource();const mode = (): AgentsMode => props.initialRoute?.mode ?? 'chat';- const dataMode = () => dataModeFor(mode());+ const workspace = createWorkspaceMode(userId());+ // A session opened from elsewhere brings its own mode, so it is never+ // hidden from the sidebar it lands in.+ if (props.initialRoute) workspace.setMode(props.initialRoute.mode);+ const dataMode = () => dataModeFor(workspace.mode());const [localPage, setPage] = createSignal<AgentsPage>('new');const isRoutinesPage = () => {const content = panel.handle.content();@@ -218,6 +223,12 @@ function AgentsWorkspace(props: { initialRoute?: AgentsRoute }) {const openRoster = (_kind: AgentKind) => {openPage('agents');};+ const changeMode = (next: AgentsMode) => {+ if (next === workspace.mode()) return;+ workspace.setMode(next);+ // The open conversation belongs to the other mode now.+ if (selected()) showComposer();+ };const openConversation = (conversation: AgentConversationTarget,event?: MouseEvent,@@ -294,6 +305,8 @@ function AgentsWorkspace(props: { initialRoute?: AgentsRoute }) {const sidebar = () => (<AgentsSidebar+ mode={workspace.mode()}+ onModeChange={changeMode}activePage={selected() ? undefined : page()}onOpenPage={(next) =>next === 'agents' ? openRoster('agent') : openPage(next)@@ -380,23 +393,28 @@ function AgentsWorkspace(props: { initialRoute?: AgentsRoute }) {class="contents"classList={{ hidden: page() !== 'new' }}>- <NewChatPage- active={- !isTouchDevice() ||- (!mobileList() && page() === 'new')- }- registerFocus={(focus) => {- composerFocus = focus;- }}- workspaceId={panel.handle.id}- draft={draft()}- onDraftChange={setDraft}- roster={rosterSource.roster()}- rosterLoading={rosterSource.loading()}- availabilityLoading={rosterSource.availabilityLoading()}- onStart={startConversation}- onOpenRoster={openRoster}- />+ <Show when={workspace.mode()} keyed>+ {(kind) => (+ <NewChatPage+ kind={kindForMode(kind)}+ active={+ !isTouchDevice() ||+ (!mobileList() && page() === 'new')+ }+ registerFocus={(focus) => {+ composerFocus = focus;+ }}+ workspaceId={panel.handle.id}+ draft={draft()}+ onDraftChange={setDraft}+ roster={rosterSource.roster()}+ rosterLoading={rosterSource.loading()}+ availabilityLoading={rosterSource.availabilityLoading()}+ onStart={startConversation}+ onOpenRoster={openRoster}+ />+ )}+ </Show></div></Suspense></div>diff --git a/apps/web/src/features/agents-view/views/NewChatPage.test.tsx b/apps/web/src/features/agents-view/views/NewChatPage.test.tsxindex fb586b2042..ce4c544d68 100644--- a/apps/web/src/features/agents-view/views/NewChatPage.test.tsx+++ b/apps/web/src/features/agents-view/views/NewChatPage.test.tsx@@ -11,6 +11,7 @@ import {} from '@solidjs/testing-library';import type { JSX } from 'solid-js';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import type { AgentKind } from '../core/agent-kind';import {buildAgentRoster,type PersistedAgentLike,@@ -211,12 +212,14 @@ function page(connected = true,agents: PersistedAgentLike[] = [],availabilityLoading = false,- runtimes: RuntimeLike[] = []+ runtimes: RuntimeLike[] = [],+ kind?: AgentKind) {const onStart = vi.fn();render(() => (<NewChatPagecompact={mocks.touch}+ kind={kind}roster={buildAgentRoster({agents,runtimes,@@ -408,6 +411,44 @@ describe('agent-led new conversation', () => {repoBranch: 'feature/home',});});+ it('offers only chat agents in Work and keeps the composer compact', async () => {+ const send = page(true, [], false, [], 'agent');+ expect(+ screen.getByRole('heading', { name: 'What should we work on?' })+ ).toBeTruthy();+ expect(screen.getByTestId('drawer').hasAttribute('hidden')).toBe(true);+ openAgents();+ expect(+ screen.getByRole('menuitem', { name: /^Chat default$/ })+ ).toBeTruthy();+ expect(screen.queryByRole('menuitem', { name: /Cursor/ })).toBeNull();+ fireEvent.keyDown(document, { key: 'Escape' });+ await waitFor(() => expect(screen.queryByRole('menu')).toBeNull());+ fireEvent.click(screen.getByRole('button', { name: 'Send' }));+ expect(send).toHaveBeenCalledWith({+ prompt: 'Prompt',+ botId: undefined,+ repoUrl: undefined,+ });+ });+ it('offers only coding agents in Code and opens the repository drawer', async () => {+ const send = page(true, [], false, [], 'coder');+ expect(+ screen.getByRole('heading', { name: 'What should we build?' })+ ).toBeTruthy();+ expect(screen.getByTestId('drawer').hasAttribute('hidden')).toBe(false);+ openAgents();+ expect(screen.getByRole('menuitem', { name: /Cursor/ })).toBeTruthy();+ expect(+ screen.queryByRole('menuitem', { name: /^Chat default$/ })+ ).toBeNull();+ fireEvent.keyDown(document, { key: 'Escape' });+ await waitFor(() => expect(screen.queryByRole('menu')).toBeNull());+ fireEvent.click(screen.getByRole('button', { name: 'Send' }));+ expect(send).toHaveBeenCalledWith(+ expect.objectContaining({ prompt: 'Prompt', botId: CURSOR_BOT_ID })+ );+ });it('restores an unsent draft after the page remounts', () => {page();fireEvent.input(screen.getByRole('textbox', { name: 'Draft' }), {diff --git a/apps/web/src/features/agents-view/views/NewChatPage.tsx b/apps/web/src/features/agents-view/views/NewChatPage.tsxindex 236f38027e..e9e4c11419 100644--- a/apps/web/src/features/agents-view/views/NewChatPage.tsx+++ b/apps/web/src/features/agents-view/views/NewChatPage.tsx@@ -57,6 +57,8 @@ export function NewChatPage(props: {autoFocus?: boolean;registerFocus?: (focus: () => void) => void;roster: RosterAgent[];+ /** Offer only this kind; the Agents workspace passes its Work or Code mode. */+ kind?: AgentKind;rosterLoading: boolean;/** Agents are listed but whether they can start is still unknown. */availabilityLoading?: boolean;@@ -69,7 +71,12 @@ export function NewChatPage(props: {const recentAgents = createRecentAgentSelections(userId());const repositories = createRecentRepositories(userId());const preferredInmem = createPreferredInmemModel(userId());- const options = () => props.roster;+ const options = () => {+ const kind = props.kind;+ return kind+ ? props.roster.filter((agent) => agent.kind === kind)+ : props.roster;+ };const [agentId, setAgentId] = createSignal<string>();/** One-shot model from a coding agent's submenu; Macro uses {@link preferredInmem}. */const [modelOverride, setModelOverride] = createSignal<string>();@@ -84,17 +91,23 @@ export function NewChatPage(props: {: persistedDraft.setDraft(text);const [branchOverride, setBranchOverride] = createSignal<string>();const recentAgentId = () => {- const ids = recentAgents.ids();// Falling back to Macro before availability is known would open the// compact composer, then swap to the last agent's layout once it settles.- if (props.rosterLoading || props.availabilityLoading) return ids[0];- return ids.find((id) =>- options().some((agent) => agent.id === id && !agent.unavailableReason)- );+ const settling = props.rosterLoading || props.availabilityLoading;+ return recentAgents+ .ids()+ .find((id) =>+ options().some(+ (agent) => agent.id === id && (settling || !agent.unavailableReason)+ )+ );};const selected = createMemo(() => {- const wanted = agentId() ?? recentAgentId() ?? MACRO_PERSONA_ID;- return options().find((agent) => agent.id === wanted) ?? options()[0];+ for (const wanted of [agentId(), recentAgentId(), MACRO_PERSONA_ID]) {+ const agent = options().find((option) => option.id === wanted);+ if (agent) return agent;+ }+ return options().find((agent) => !agent.unavailableReason) ?? options()[0];});const selectedCatalog = createComposerModels(selected);/** In-memory choices come from the owner's catalog; other runtimes keep their rules. */@@ -148,7 +161,7 @@ export function NewChatPage(props: {? { configId: selection.configId, value: selection.value }: undefined;};- const coding = () => selected()?.kind === 'coder';+ const coding = () => (props.kind ?? selected()?.kind) === 'coder';const localRuntime = () => selected()?.harness === 'macrod';const canSelectRepository = () =>selected()?.harness === 'cursor' || localRuntime();diff --git a/docs/AGENT_GUIDE/navigation.md b/docs/AGENT_GUIDE/navigation.mdindex 7aaad05c1b..694c706e49 100644--- a/docs/AGENT_GUIDE/navigation.md+++ b/docs/AGENT_GUIDE/navigation.md@@ -340,7 +340,13 @@ the list. Check that reading that item keeps the dot lit if another loaded rowis unread, and that completing the last one clears it. Query bounds andpagination are unchanged.-The Agents sidebar mixes chat and coding sessions in one newest-first list.+The Agents sidebar opens with a **Work** / **Code** switch (radio group+"Agents mode") under its title; Work is the default and the choice is remembered+per user across reloads. Work lists chat sessions and legacy chats; Code lists+coding sessions only, newest first. Each mode's empty state is its own ("No+conversations yet." / "No coding conversations yet."). Opening a session of the+other kind from outside Agents (a link, Home, Ask AI) switches the mode to match;+switching modes while a session is open returns to that mode's New conversation.New agent sessions use one dot in the left slot for activity and notifications:pulsing accent for starting/working, amber for waiting for input, and solid accentfor an unread dormant session. Read dormant sessions leave that slot empty.@@ -355,10 +361,13 @@ the selected background. Legacy chat rows keep their chat icon.Use **Search conversations** beside the Conversations heading to filter by title.Results stay packed at the top with compact spacing, even with only a few matches;clearing the search restores the list.-Its **New conversation** button opens the unified composer with one **Agent**-selector on the right. Choosing a coding agent reveals the repository drawer;-there is no Chat/Code switch. New sessions use the selected agent's default model-and the URL for its kind. Opening an existing row restores its own kind and URL.+Its **New conversation** button opens the composer for the current mode with one+**Agent** selector on the right. In Work the selector lists Macro's models and+chat agents, and the composer stays on one line. In Code it lists coding agents+only, the composer opens expanded with the repository drawer below it, and the+greeting reads "What should we build?". New sessions use the selected agent's+default model and the URL for its kind. Home's composer is unchanged and still+offers both kinds. Opening an existing row restores its own kind and URL.Right-click a conversation for Rename, Favorite, Copy link, Share, Delete, andthe other entity actions used on Home.diff --git a/docs/AGENT_GUIDE/view-tours.md b/docs/AGENT_GUIDE/view-tours.mdindex 2222f1b1f6..ec1108e88b 100644--- a/docs/AGENT_GUIDE/view-tours.md+++ b/docs/AGENT_GUIDE/view-tours.md@@ -34,7 +34,8 @@ and highlights.## Per view-- **Agents:** agent and model picker (beacon on New conversation), then the+- **Agents:** the Work / Code switch (beacon on the sidebar toggle), then the+ agent and model picker (beacon on New conversation), then theagents and Runtimes tabs (beacon on Agents), then Create for automations.- **Channels:** channels and DMs, creation, then threads, @mentions, and calls,which wait on the channel list until a conversation is open. No Slack action.