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(routines): list routines in settings on touch devices (#8769)
gbirman0b0ccc3e0980
diff --git a/apps/web/src/features/routines/components/routines-list.tsx b/apps/web/src/features/routines/components/routines-list.tsxindex 65ec0fdac1..fafe3b8ad8 100644--- a/apps/web/src/features/routines/components/routines-list.tsx+++ b/apps/web/src/features/routines/components/routines-list.tsx@@ -16,6 +16,8 @@ export function RoutinesList(props: {loading: boolean;error: boolean;pendingId?: string;+ /** False where the host already titles the page, as Settings does. */+ showTitle?: boolean;registerSearchFocus?: (focus: () => void) => void;onCreate: () => void;onOpen: (id: string, history?: boolean) => void;@@ -36,9 +38,11 @@ export function RoutinesList(props: {when={!isTouchDevice()}fallback={<ViewShell.Header>- <h1 class="mb-3 text-xl font-semibold tracking-[-0.03em] text-ink">- Routines- </h1>+ <Show when={props.showTitle !== false}>+ <h1 class="mb-3 text-xl font-semibold tracking-[-0.03em] text-ink">+ Routines+ </h1>+ </Show><div class="flex min-w-0 items-center justify-between gap-3"><SearchBarref={(input) =>diff --git a/apps/web/src/features/routines/queries/routine-target-display.ts b/apps/web/src/features/routines/queries/routine-target-display.tsnew file mode 100644index 0000000000..ffa6bb4467--- /dev/null+++ b/apps/web/src/features/routines/queries/routine-target-display.ts@@ -0,0 +1,20 @@+import { modelLabel } from '@core/component/AI/constant/model-label';+import { createAgentRosterSource } from '../../agents-view/queries/agent-roster-source';+import type { RoutineTarget } from '../core/routine-target';++/** How a routine list names each routine's agent or model. */+export function createRoutineTargetDisplay() {+ const roster = createAgentRosterSource();+ const agent = (agentId: string) =>+ roster.roster().find((candidate) => candidate.botId === agentId);+ return {+ targetLabel: (target: RoutineTarget) =>+ target.kind === 'agent'+ ? (agent(target.agentId)?.name ?? 'Agent')+ : modelLabel(target.model),+ targetModel: (target: RoutineTarget) =>+ target.kind === 'agent'+ ? (target.modelOverride ?? agent(target.agentId)?.defaultModel)+ : target.model,+ };+}diff --git a/apps/web/src/features/routines/routine-settings.test.tsx b/apps/web/src/features/routines/routine-settings.test.tsxnew file mode 100644index 0000000000..2f3e08c8c6--- /dev/null+++ b/apps/web/src/features/routines/routine-settings.test.tsx@@ -0,0 +1,98 @@+import { SettingsSheetContext } from '@app/features/settings/primitives';+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';+import { afterEach, describe, expect, it, vi } from 'vitest';+import type { RoutineListSource } from './context/routine-sources';+import { RoutineSettings } from './routine-settings';++const mocks = vi.hoisted(() => ({+ close: vi.fn(),+ openAgentsPage: vi.fn(),+ popoverSplit: vi.fn(),+}));+const layout = { openWithSplit: vi.fn(), popoverSplit: mocks.popoverSplit };++vi.mock('@service-connection/websocket', () => ({+ ws: { addEventListener: vi.fn(), send: vi.fn() },+ state: () => 'closed',+ createConnectionBlockWebsocketEffect: vi.fn(),+ createConnectionWebsocketEffect: vi.fn(),+}));+vi.mock('@service-storage/websocket', () => ({+ storageWS: { reconnectIfDisconnected: vi.fn() },+ createWebSocketJob: vi.fn(),+}));+vi.mock('@core/mobile/isTouchDevice', () => ({ isTouchDevice: () => true }));+vi.mock('@components/app/split-layout/layout', () => ({+ useSplitLayout: () => layout,+}));+vi.mock('@app/features/settings/context/mobile-settings', () => ({+ useMobileSettings: () => ({ close: mocks.close }),+}));+vi.mock('@app/features/agents-view/primitives/open-page', () => ({+ openAgentsPage: mocks.openAgentsPage,+}));+vi.mock('@core/context/user', () => ({+ useUserId: () => () => 'macro|[email protected]',+}));+vi.mock('./queries/routine-target-display', () => ({+ createRoutineTargetDisplay: () => ({+ targetLabel: () => 'Sonnet 5.5',+ targetModel: () => undefined,+ }),+}));+vi.mock('./queries/routine-sources', () => ({+ createRoutineListSource: (): RoutineListSource => ({+ routines: () => [+ {+ id: 'briefing',+ name: 'Morning briefing',+ ownerId: 'macro|[email protected]',+ createdAt: '2026-10-01T09:00:00Z',+ enabled: true,+ revision: 1,+ configurationKey: 'briefing',+ },+ ],+ loading: () => false,+ error: () => false,+ refresh: async () => undefined,+ setEnabled: vi.fn(),+ pendingId: () => undefined,+ }),+}));++afterEach(() => {+ cleanup();+ vi.clearAllMocks();+});++describe('routine settings', () => {+ it('closes the sheet and opens the tapped routine', () => {+ render(() => (+ <SettingsSheetContext.Provider value={true}>+ <RoutineSettings />+ </SettingsSheetContext.Provider>+ ));+ expect(screen.queryByRole('heading', { name: 'Routines' })).toBeNull();+ fireEvent.click(screen.getByRole('button', { name: 'Morning briefing' }));+ expect(mocks.close).toHaveBeenCalledOnce();+ expect(mocks.openAgentsPage).toHaveBeenCalledWith(layout, 'routines', {+ routineId: 'briefing',+ });+ });++ it('opens the composer and the created routine from Create', () => {+ render(() => <RoutineSettings />);+ expect(screen.getAllByRole('heading', { name: 'Routines' })).toHaveLength(+ 1+ );+ fireEvent.click(screen.getByRole('button', { name: 'Create Routine' }));+ expect(mocks.close).toHaveBeenCalledOnce();+ const content = mocks.popoverSplit.mock.calls[0][0];+ expect(content).toMatchObject({ type: 'component', id: 'routine-compose' });+ content.params.onCreated('created');+ expect(mocks.openAgentsPage).toHaveBeenCalledWith(layout, 'routines', {+ routineId: 'created',+ });+ });+});diff --git a/apps/web/src/features/routines/routine-settings.tsx b/apps/web/src/features/routines/routine-settings.tsxnew file mode 100644index 0000000000..7be72275ed--- /dev/null+++ b/apps/web/src/features/routines/routine-settings.tsx@@ -0,0 +1,46 @@+import { openAgentsPage } from '@app/features/agents-view/primitives/open-page';+import { useMobileSettings } from '@app/features/settings/context/mobile-settings';+import { SettingsPage } from '@app/features/settings/primitives';+import { useSplitLayout } from '@components/app/split-layout/layout';+import { toast } from '@core/component/Toast/Toast';+import { useUserId } from '@core/context/user';+import { getErrorMessage } from './core/routine-draft';+import { createRoutineListSource } from './queries/routine-sources';+import { createRoutineTargetDisplay } from './queries/routine-target-display';+import { RoutinesListView } from './views/routines-list';++/** Settings → Routines: the touch entry to the list the Agents sidebar links on desktop. */+export function RoutineSettings() {+ const layout = useSplitLayout();+ const settings = useMobileSettings();+ const userId = useUserId();+ const display = createRoutineTargetDisplay();+ const source = createRoutineListSource((error) =>+ toast.alert('Could not update routine', { subtext: getErrorMessage(error) })+ );+ const open = (id: string) => {+ settings.close();+ openAgentsPage(layout, 'routines', { routineId: id });+ };+ const create = () => {+ settings.close();+ layout.popoverSplit({+ type: 'component',+ id: 'routine-compose',+ params: { onCreated: open },+ });+ };+ return (+ <SettingsPage title="Routines" bodyClass="[--mobile-content-inset-top:0px]">+ <RoutinesListView+ source={source}+ userId={userId}+ targetLabel={display.targetLabel}+ targetModel={display.targetModel}+ showTitle={false}+ onCreate={create}+ onOpen={open}+ />+ </SettingsPage>+ );+}diff --git a/apps/web/src/features/routines/routines-page.tsx b/apps/web/src/features/routines/routines-page.tsxindex 16275b142c..b6f0f67ab9 100644--- a/apps/web/src/features/routines/routines-page.tsx+++ b/apps/web/src/features/routines/routines-page.tsx@@ -1,13 +1,12 @@import { useViewControlHotkeys } from '@app/components/view-shell';import { useSplitLayout } from '@components/app/split-layout/layout';import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';-import { modelLabel } from '@core/component/AI/constant/model-label';import { toast } from '@core/component/Toast/Toast';import { useUserId } from '@core/context/user';import { Show, Suspense } from 'solid-js';-import { createAgentRosterSource } from '../agents-view/queries/agent-roster-source';import { getErrorMessage } from './core/routine-draft';import { createRoutineListSource } from './queries/routine-sources';+import { createRoutineTargetDisplay } from './queries/routine-target-display';import { RoutineDetail } from './routine-detail';import { routineContent, routineIdFromContent } from './routine-navigation';import { RoutinesListView } from './views/routines-list';@@ -35,7 +34,7 @@ function RoutinesContent() {},},});- const roster = createAgentRosterSource();+ const display = createRoutineTargetDisplay();const source = createRoutineListSource((error) =>toast.alert('Could not update routine', { subtext: getErrorMessage(error) }));@@ -56,19 +55,8 @@ function RoutinesContent() {<RoutinesListViewsource={source}userId={userId}- targetLabel={(target) =>- target.kind === 'agent'- ? (roster.roster().find((agent) => agent.botId === target.agentId)- ?.name ?? 'Agent')- : modelLabel(target.model)- }- targetModel={(target) =>- target.kind === 'agent'- ? (target.modelOverride ??- roster.roster().find((agent) => agent.botId === target.agentId)- ?.defaultModel)- : target.model- }+ targetLabel={display.targetLabel}+ targetModel={display.targetModel}registerSearchFocus={(focus) => (focusSearch = focus)}onCreate={create}onOpen={(id) => open(id)}diff --git a/apps/web/src/features/routines/views/routines-list.tsx b/apps/web/src/features/routines/views/routines-list.tsxindex 4e3f4263cb..47af6e4a83 100644--- a/apps/web/src/features/routines/views/routines-list.tsx+++ b/apps/web/src/features/routines/views/routines-list.tsx@@ -10,7 +10,8 @@ export function RoutinesListView(props: {userId: Accessor<string | undefined>;targetLabel(target: RoutineTarget): string;targetModel(target: RoutineTarget): string | undefined;- registerSearchFocus(focus: () => void): void;+ showTitle?: boolean;+ registerSearchFocus?: (focus: () => void) => void;onCreate(): void;onOpen(id: string): void;}) {@@ -22,6 +23,7 @@ export function RoutinesListView(props: {);return (<RoutinesList+ showTitle={props.showTitle}registerSearchFocus={props.registerSearchFocus}rows={rows()}loading={props.source.loading()}diff --git a/apps/web/src/features/settings/SettingsTabContent.tsx b/apps/web/src/features/settings/SettingsTabContent.tsxindex d5f4bd3f13..70710701cc 100644--- a/apps/web/src/features/settings/SettingsTabContent.tsx+++ b/apps/web/src/features/settings/SettingsTabContent.tsx@@ -1,5 +1,6 @@import type { SettingsTab } from '@core/constant/SettingsState';import { useSettingsTabAvailable } from '@core/constant/settingsTabsConfig';+import { lazyNamed } from '@core/util/lazyNamed';import { Show, Suspense } from 'solid-js';import { CalendarSettings } from '../calendar/calendar-settings';import { CrmSettings as Crm } from '../crm/crm-settings';@@ -24,6 +25,11 @@ import { TeamConnections } from './TeamConnections';import { TeamGeneral } from './TeamGeneral';import { TeamMembers } from './TeamMembers';+const RoutineSettings = lazyNamed(+ () => import('../routines/routine-settings'),+ 'RoutineSettings'+);+/** Shared forms for desktop panels and mobile sheet detail pages. */export function SettingsTabContent(props: { tab: SettingsTab }) {const isAvailable = useSettingsTabAvailable();@@ -94,6 +100,9 @@ export function SettingsTabContent(props: { tab: SettingsTab }) {<Show when={isCurrentTab('Agents')}><AgentSettings /></Show>+ <Show when={isCurrentTab('Routines')}>+ <RoutineSettings />+ </Show><Show when={isCurrentTab('Harness')}><AgentSettings initialSection="runtimes" /></Show>diff --git a/apps/web/src/lib/core/constant/SettingsState.tsx b/apps/web/src/lib/core/constant/SettingsState.tsxindex cbbb1aa809..02f52f52a4 100644--- a/apps/web/src/lib/core/constant/SettingsState.tsx+++ b/apps/web/src/lib/core/constant/SettingsState.tsx@@ -29,6 +29,7 @@ export type SettingsTab =| 'Desktop App'| 'Agent'| 'Agents'+ | 'Routines'| 'Harness'| 'Bots'| 'Team'diff --git a/apps/web/src/lib/core/constant/settingsTabsAvailability.test.ts b/apps/web/src/lib/core/constant/settingsTabsAvailability.test.tsindex d8922b0f64..f9d9d9542b 100644--- a/apps/web/src/lib/core/constant/settingsTabsAvailability.test.ts+++ b/apps/web/src/lib/core/constant/settingsTabsAvailability.test.ts@@ -3,13 +3,20 @@ import { afterEach, describe, expect, it, vi } from 'vitest';import { useSettingsTabs } from './settingsTabsConfig';const platform = vi.hoisted(() => ({ current: 'web' }));+const touch = vi.hoisted(() => ({ current: false }));let flagEnabled: () => boolean;+let agentsEnabled: () => boolean = () => false;vi.mock('@app/lib/analytics/posthog', () => ({useFeatureFlag: (flag: { key: string }) => () => ({- enabled: flag.key === 'desktop-app' && flagEnabled(),+ enabled:+ (flag.key === 'desktop-app' && flagEnabled()) ||+ (flag.key === 'enable-chat-v3-agents' && agentsEnabled()),}),}));+vi.mock('../mobile/isTouchDevice', () => ({+ isTouchDevice: () => touch.current,+}));vi.mock('../context/user', () => ({ useHasPermission: () => () => false }));vi.mock('../util/platform', async (importOriginal) => ({...(await importOriginal<typeof import('../util/platform')>()),@@ -77,3 +84,31 @@ describe('Notifications settings', () => {});});++describe('Routines settings', () => {+ // Desktop lists Routines in the Agents sidebar, which touch hides.+ it.each([+ { onTouch: false, agents: true, expected: false },+ { onTouch: true, agents: false, expected: false },+ { onTouch: true, agents: true, expected: true },+ ])(+ 'is available on touch=$onTouch with agents=$agents: $expected',+ ({ onTouch, agents, expected }) => {+ touch.current = onTouch;+ agentsEnabled = () => agents;+ const tabs = createRoot((cleanup) => {+ dispose = cleanup;+ flagEnabled = () => false;+ return useSettingsTabs();+ });++ expect(tabs.isAvailable('Routines')).toBe(expected);+ const blocks = tabs.groups().find((group) => group.label === 'Blocks');+ expect(blocks?.items.map((item) => item.tab).includes('Routines')).toBe(+ expected+ );+ touch.current = false;+ agentsEnabled = () => false;+ }+ );+});diff --git a/apps/web/src/lib/core/constant/settingsTabsConfig.test.ts b/apps/web/src/lib/core/constant/settingsTabsConfig.test.tsindex 1b9fde679a..fd6f139734 100644--- a/apps/web/src/lib/core/constant/settingsTabsConfig.test.ts+++ b/apps/web/src/lib/core/constant/settingsTabsConfig.test.ts@@ -48,6 +48,7 @@ describe('settings navigation', () => {'Email','Calendar','Agents',+ 'Routines','CRM',]);const workspace = SETTINGS_TAB_GROUPS.find(diff --git a/apps/web/src/lib/core/constant/settingsTabsConfig.tsx b/apps/web/src/lib/core/constant/settingsTabsConfig.tsxindex a1f5822ecc..d1f167bdb9 100644--- a/apps/web/src/lib/core/constant/settingsTabsConfig.tsx+++ b/apps/web/src/lib/core/constant/settingsTabsConfig.tsx@@ -3,6 +3,7 @@ import BellIcon from '@phosphor/bell-simple.svg';import BugIcon from '@phosphor/bug.svg';import BuildingsIcon from '@phosphor/buildings.svg';import CalendarIcon from '@phosphor/calendar-blank.svg';+import RoutineIcon from '@phosphor/clock-clockwise.svg';import CpuIcon from '@phosphor/cpu.svg';import CreditCardIcon from '@phosphor/credit-card.svg';import DesktopIcon from '@phosphor/desktop.svg';@@ -126,6 +127,12 @@ export const SETTINGS_TAB_GROUPS: SettingsTabGroup[] = [icon: AgentIcon,keywords: ['ai', 'assistant', 'bot'],},+ {+ tab: 'Routines',+ label: 'Routines',+ icon: RoutineIcon,+ keywords: ['automation', 'schedule', 'scheduled', 'recurring'],+ },{tab: 'CRM',label: 'CRM',@@ -269,6 +276,7 @@ const SETTINGS_TAB_SLUGS: Record<SettingsTab, string> = {'Desktop App': 'desktop-app',Agent: 'mcp-server',Agents: 'agents',+ Routines: 'routines',Harness: 'runtimes',Bots: 'bots',Team: 'team',@@ -363,6 +371,10 @@ export const useSettingsTabAvailable = () => {case 'Harness':case 'Agents':return chatV3AgentsFlag().enabled;+ // Touch hides the Agents sidebar that lists Routines on desktop, so+ // phones and tablets reach the list here, beside Agents.+ case 'Routines':+ return chatV3AgentsFlag().enabled && isTouchDevice();case 'Bots':return botManagementFlag().enabled;case 'Mobile':diff --git a/docs/agent-guide/navigation.md b/docs/agent-guide/navigation.mdindex 50d43b7f7f..3deaacc434 100644--- a/docs/agent-guide/navigation.md+++ b/docs/agent-guide/navigation.md@@ -744,7 +744,10 @@ Existing `/app/automation/<uuid>` links resolve to the canonical routine URL.Saved split layouts and document/channel/spreadsheet mentions using the oldblock name also open routines; newly copied links use `/app/routines/<uuid>`.On the legacy Agents screen, use the **Routines** button above the list. On touch devices,-`/app/routines` opens the routines list directly. Routines use+`/app/routines` opens the routines list directly, and the hidden Agents sidebar's+entry moves to **Settings → Routines** (on phones **More views → Settings →+Routines**): tapping a routine closes the settings sheet and opens it, and+**Create Routine** opens the composer. Routines usefull-width entity rows with **Created by**, **Status**, **Runs with**, and **Enabled**columns. The search field sits below the top bar, as in Projects; search by name,creator, or model/agent, or press **Cmd/Ctrl+F** to focus it. **Create Routine** sitsdiff --git a/docs/agent-guide/settings.md b/docs/agent-guide/settings.mdindex 940dcff456..ced3b9295b 100644--- a/docs/agent-guide/settings.md+++ b/docs/agent-guide/settings.md@@ -251,7 +251,8 @@ Left nav (feature and platform gates still apply):only General shows, with pending invitations or **Create Team**. Searchfinds these by `invite`, `members`, `teammates`, `slack`, and similar terms;results name their group, e.g. **Team · Members**.-- **Blocks**: Email, Calendar, Agents, CRM.+- **Blocks**: Email, Calendar, Agents, CRM. On touch devices, where the Agents+ sidebar is hidden, **Routines** (`/app/settings/routines`) follows Agents.- **Personal**: Account, Appearance, Notifications, Keyboard shortcuts, Usage, Billing, Desktop App, Mobile App.- **Workspace**: Tags, Integrations (personal Gmail/GitHub accounts and agent tools).- **Developer**: Runtimes, MCP server, API Keys, Bots.