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): add rename and delete to Agents sidebar sessions (#6650)

Wolf Mermelsteindaea151bace6
diff --git a/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx b/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx
index 71654bf466..926a740570 100644
--- a/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx
+++ b/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx
@@ -1,5 +1,11 @@
import { HomeListEntity } from '@app/features/inbox-view/components/HomeListEntity';
-import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ within,
+} from '@solidjs/testing-library';
import { createSignal, type JSX } from 'solid-js';
import { afterEach, describe, expect, it, vi } from 'vitest';
import {
@@ -81,6 +87,40 @@ vi.mock('@components/app/split-layout/layoutUtils', () => ({
isPanelActive: () => true,
}),
}));
+vi.mock('@app/features/next-soup/actions', () => ({
+ toEntityActionListState: () => ({
+ focus: { set: vi.fn() },
+ }),
+}));
+vi.mock('@app/features/soup', () => ({
+ MaybeSoupEntityActionDrawerManager: (props: { children: JSX.Element }) =>
+ props.children,
+ SoupEntityContextMenu: (props: {
+ children: JSX.Element;
+ entity: { id: string };
+ }) => {
+ const [open, setOpen] = createSignal(false);
+ return (
+ <div
+ data-entity-context-menu={props.entity.id}
+ onContextMenu={(event) => {
+ event.preventDefault();
+ setOpen(true);
+ }}
+ >
+ {props.children}
+ {open() && (
+ <div role="menu">
+ <div role="menuitem">Rename</div>
+ <div role="menuitem">Favorite</div>
+ <div role="menuitem">Copy Link</div>
+ <div role="menuitem">Delete</div>
+ </div>
+ )}
+ </div>
+ );
+ },
+}));
vi.mock('@components/app/split-panel', () => ({
SplitPanel: { CloseButton: () => null },
}));
@@ -140,6 +180,60 @@ describe('mixed Agents sidebar', () => {
fireEvent.click(screen.getByRole('button', { name: 'New conversation' }));
expect(create).toHaveBeenCalledOnce();
});
+
+ it('opens rename and delete on a session or chat right-click', async () => {
+ render(() => (
+ <AgentsSidebar
+ groups={groupConversations([
+ {
+ type: 'agent_session',
+ id: 'code',
+ name: 'Fix build',
+ ownerId: 'me',
+ botId: 'cursor',
+ status: 'acp_ready',
+ },
+ { type: 'chat', id: 'chat', name: 'Plan launch', ownerId: 'me' },
+ ])}
+ modeForConversation={(conversation) =>
+ conversation.id === 'code' ? 'code' : 'chat'
+ }
+ activeConversationId={undefined}
+ search=""
+ loading={false}
+ error={false}
+ hasNextPage={false}
+ loadingNextPage={false}
+ onNewConversation={vi.fn()}
+ onSearchChange={vi.fn()}
+ onOpenConversation={vi.fn()}
+ onRetry={vi.fn()}
+ onLoadMore={vi.fn()}
+ />
+ ));
+
+ const session = screen.getByRole('button', { name: /Fix build/ });
+ fireEvent.contextMenu(session);
+ const sessionMenu = within(
+ session.closest('[data-entity-context-menu]') as HTMLElement
+ );
+ expect(sessionMenu.getByRole('menuitem', { name: 'Rename' })).toBeTruthy();
+ expect(sessionMenu.getByRole('menuitem', { name: 'Delete' })).toBeTruthy();
+ expect(
+ sessionMenu.getByRole('menuitem', { name: 'Favorite' })
+ ).toBeTruthy();
+ expect(
+ sessionMenu.getByRole('menuitem', { name: 'Copy Link' })
+ ).toBeTruthy();
+
+ const chat = screen.getByRole('button', { name: /Plan launch/ });
+ fireEvent.contextMenu(chat);
+ const chatMenu = within(
+ chat.closest('[data-entity-context-menu]') as HTMLElement
+ );
+ expect(chatMenu.getByRole('menuitem', { name: 'Rename' })).toBeTruthy();
+ expect(chatMenu.getByRole('menuitem', { name: 'Delete' })).toBeTruthy();
+ });
});
describe.each(['home', 'sidebar'] as const)('%s agent rows', (surface) => {
diff --git a/apps/web/src/features/agents-view/components/AgentsSidebar.tsx b/apps/web/src/features/agents-view/components/AgentsSidebar.tsx
index 30f53c5a19..dd826697cc 100644
--- a/apps/web/src/features/agents-view/components/AgentsSidebar.tsx
+++ b/apps/web/src/features/agents-view/components/AgentsSidebar.tsx
@@ -1,3 +1,4 @@
+import { createListController } from '@app/components/list';
import {
CollapsibleSection,
SearchBar,
@@ -5,12 +6,21 @@ import {
ViewSidebar,
} from '@app/components/view-shell';
import { SidebarCreateButton } from '@app/components/view-shell/SidebarCreateButton';
+import {
+ type EntityActionListState,
+ type EntityActionViewContext,
+ toEntityActionListState,
+} from '@app/features/next-soup/actions';
+import {
+ MaybeSoupEntityActionDrawerManager,
+ SoupEntityContextMenu,
+} from '@app/features/soup';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import ChatIcon from '@phosphor/chat-circle.svg';
import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';
import { Key } from '@solid-primitives/keyed';
import { cn } from '@ui';
-import { createSignal, Show } from 'solid-js';
+import { createSignal, type JSX, Show } from 'solid-js';
import { compactAge } from '../core/format-age';
import type { AgentsMode } from '../core/mode';
import {
@@ -20,6 +30,11 @@ import {
} from '../core/recent-conversations';
import { AgentSessionListItem } from '../views/AgentSessionListItem';
+const AGENTS_ACTION_VIEW_CONTEXT: EntityActionViewContext = {
+ supportsMarkDone: false,
+ senderBucket: undefined,
+};
+
export type AgentsSidebarProps = {
modeForConversation: (conversation: AgentConversationEntity) => AgentsMode;
activeConversationId: string | undefined;
@@ -39,6 +54,29 @@ export type AgentsSidebarProps = {
onLoadMore: () => void;
};
+function ConversationContextMenu(props: {
+ conversation: AgentConversationEntity;
+ list: EntityActionListState;
+ children: JSX.Element;
+}) {
+ return (
+ <SoupEntityContextMenu
+ entity={props.conversation}
+ list={props.list}
+ selectedEntities={() => []}
+ viewContext={AGENTS_ACTION_VIEW_CONTEXT}
+ as="div"
+ class="block w-full"
+ onOpenChange={(open) => {
+ if (!open) return;
+ props.list.focus.set(props.conversation.id);
+ }}
+ >
+ {props.children}
+ </SoupEntityContextMenu>
+ );
+}
+
function Row(props: {
conversation: AgentConversationEntity;
mode: AgentsMode;
@@ -83,6 +121,17 @@ export function AgentsSidebar(props: AgentsSidebarProps) {
const [searchOpen, setSearchOpen] = createSignal(false);
const [conversationsOpen, setConversationsOpen] = createSignal(true);
let searchInput: HTMLInputElement | undefined;
+ const conversations = () =>
+ props.groups.flatMap((group) => group.conversations);
+ const actionController = createListController({
+ items: conversations,
+ getKey: (conversation) => conversation.id,
+ isSelectable: () => false,
+ });
+ const actionList = toEntityActionListState({
+ controller: actionController,
+ getEntity: (conversation) => conversation,
+ });
const total = () =>
props.groups.reduce((sum, group) => sum + group.conversations.length, 0);
@@ -109,131 +158,138 @@ export function AgentsSidebar(props: AgentsSidebarProps) {
});
return (
- <ViewSidebar.Root aria-label="Agents navigation">
- <ViewSidebar.Header>
- <div class="flex min-w-0 items-center gap-1">
- <ViewSidebar.CloseButton />
- <ViewSidebar.Title>Agents</ViewSidebar.Title>
- </div>
- </ViewSidebar.Header>
+ <MaybeSoupEntityActionDrawerManager>
+ <ViewSidebar.Root aria-label="Agents navigation">
+ <ViewSidebar.Header>
+ <div class="flex min-w-0 items-center gap-1">
+ <ViewSidebar.CloseButton />
+ <ViewSidebar.Title>Agents</ViewSidebar.Title>
+ </div>
+ </ViewSidebar.Header>
- <ViewSidebar.Primary>
- <SidebarCreateButton
- label="New conversation"
- onCreate={props.onNewConversation}
- />
- </ViewSidebar.Primary>
+ <ViewSidebar.Primary>
+ <SidebarCreateButton
+ label="New conversation"
+ onCreate={props.onNewConversation}
+ />
+ </ViewSidebar.Primary>
- <ViewSidebar.Content class="overflow-hidden">
- <CollapsibleSection.Root
- open={conversationsOpen()}
- onOpenChange={setConversationsOpen}
- class={cn(
- 'flex min-h-0 flex-col',
- conversationsOpen() ? 'flex-1' : 'shrink-0'
- )}
- >
- <CollapsibleSection.Header>
- <CollapsibleSection.Trigger class="flex-1">
- <span class="min-w-0 truncate">Conversations</span>
- <CollapsibleSection.Indicator />
- </CollapsibleSection.Trigger>
- <CollapsibleSection.Action
- label="Search conversations"
- aria-pressed={searchOpen()}
- class={cn(searchOpen() && 'bg-active text-ink')}
- onClick={() => (searchOpen() ? closeSearch() : openSearch())}
- >
- <MagnifyingGlassIcon class="size-3.5" />
- </CollapsibleSection.Action>
- </CollapsibleSection.Header>
- <CollapsibleSection.Content class="flex min-h-0 flex-1 flex-col gap-1">
- <Show when={searchOpen()}>
- <SearchBar
- ref={searchInput}
- placeholder="Search conversations"
+ <ViewSidebar.Content class="overflow-hidden">
+ <CollapsibleSection.Root
+ open={conversationsOpen()}
+ onOpenChange={setConversationsOpen}
+ class={cn(
+ 'flex min-h-0 flex-col',
+ conversationsOpen() ? 'flex-1' : 'shrink-0'
+ )}
+ >
+ <CollapsibleSection.Header>
+ <CollapsibleSection.Trigger class="flex-1">
+ <span class="min-w-0 truncate">Conversations</span>
+ <CollapsibleSection.Indicator />
+ </CollapsibleSection.Trigger>
+ <CollapsibleSection.Action
label="Search conversations"
- value={props.search}
- onValueChange={props.onSearchChange}
- onEscape={() => {
- if (!props.search) closeSearch();
- }}
- class="h-9 shrink-0 rounded-xl"
- />
- </Show>
- <ViewSidebar.Nav
- class="min-h-0 flex-1 shrink overflow-auto"
- aria-label="Recent conversations"
- onScroll={(event) => {
- const list = event.currentTarget;
- if (!props.hasNextPage || props.loadingNextPage) return;
- if (
- list.scrollTop + list.clientHeight >=
- list.scrollHeight - 200
- ) {
- props.onLoadMore();
- }
- }}
- >
- <Key each={props.groups} by="id">
- {(group) => (
- <>
- <Show when={group().label}>
- {(label) => (
- <ViewSidebar.Toolbar>
- <h3 class="text-xs font-medium text-ink-muted">
- {label()}
- </h3>
- <span class="text-xs text-ink-extra-muted tabular-nums">
- {group().conversations.length}
- </span>
- </ViewSidebar.Toolbar>
- )}
- </Show>
- <Key each={group().conversations} by="id">
- {(conversation) => (
- <Row
- conversation={conversation()}
- mode={props.modeForConversation(conversation())}
- active={
- props.activeConversationId === conversation().id
- }
- onOpen={(event) =>
- props.onOpenConversation(conversation(), event)
- }
- />
- )}
- </Key>
- </>
- )}
- </Key>
- <Show when={props.loading}>
- <p class="px-(--sidebar-item-inset) py-2 text-xs text-ink-muted">
- Loading conversations…
- </p>
- </Show>
- <Show when={props.error}>
- <ViewSidebar.Item onClick={props.onRetry}>
- <ViewSidebar.Icon />
- <span class="truncate">Retry loading</span>
- </ViewSidebar.Item>
- </Show>
- <Show when={!props.loading && !props.error && total() === 0}>
- <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.'}
- </p>
+ aria-pressed={searchOpen()}
+ class={cn(searchOpen() && 'bg-active text-ink')}
+ onClick={() => (searchOpen() ? closeSearch() : openSearch())}
+ >
+ <MagnifyingGlassIcon class="size-3.5" />
+ </CollapsibleSection.Action>
+ </CollapsibleSection.Header>
+ <CollapsibleSection.Content class="flex min-h-0 flex-1 flex-col gap-1">
+ <Show when={searchOpen()}>
+ <SearchBar
+ ref={searchInput}
+ placeholder="Search conversations"
+ label="Search conversations"
+ value={props.search}
+ onValueChange={props.onSearchChange}
+ onEscape={() => {
+ if (!props.search) closeSearch();
+ }}
+ class="h-9 shrink-0 rounded-xl"
+ />
</Show>
- <Show when={props.loadingNextPage}>
- <p class="px-(--sidebar-item-inset) py-2 text-xs text-ink-muted">
- Loading more…
- </p>
- </Show>
- </ViewSidebar.Nav>
- </CollapsibleSection.Content>
- </CollapsibleSection.Root>
- </ViewSidebar.Content>
- </ViewSidebar.Root>
+ <ViewSidebar.Nav
+ class="min-h-0 flex-1 shrink overflow-auto"
+ aria-label="Recent conversations"
+ onScroll={(event) => {
+ const list = event.currentTarget;
+ if (!props.hasNextPage || props.loadingNextPage) return;
+ if (
+ list.scrollTop + list.clientHeight >=
+ list.scrollHeight - 200
+ ) {
+ props.onLoadMore();
+ }
+ }}
+ >
+ <Key each={props.groups} by="id">
+ {(group) => (
+ <>
+ <Show when={group().label}>
+ {(label) => (
+ <ViewSidebar.Toolbar>
+ <h3 class="text-xs font-medium text-ink-muted">
+ {label()}
+ </h3>
+ <span class="text-xs text-ink-extra-muted tabular-nums">
+ {group().conversations.length}
+ </span>
+ </ViewSidebar.Toolbar>
+ )}
+ </Show>
+ <Key each={group().conversations} by="id">
+ {(conversation) => (
+ <ConversationContextMenu
+ conversation={conversation()}
+ list={actionList}
+ >
+ <Row
+ conversation={conversation()}
+ mode={props.modeForConversation(conversation())}
+ active={
+ props.activeConversationId === conversation().id
+ }
+ onOpen={(event) =>
+ props.onOpenConversation(conversation(), event)
+ }
+ />
+ </ConversationContextMenu>
+ )}
+ </Key>
+ </>
+ )}
+ </Key>
+ <Show when={props.loading}>
+ <p class="px-(--sidebar-item-inset) py-2 text-xs text-ink-muted">
+ Loading conversations…
+ </p>
+ </Show>
+ <Show when={props.error}>
+ <ViewSidebar.Item onClick={props.onRetry}>
+ <ViewSidebar.Icon />
+ <span class="truncate">Retry loading</span>
+ </ViewSidebar.Item>
+ </Show>
+ <Show when={!props.loading && !props.error && total() === 0}>
+ <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.'}
+ </p>
+ </Show>
+ <Show when={props.loadingNextPage}>
+ <p class="px-(--sidebar-item-inset) py-2 text-xs text-ink-muted">
+ Loading more…
+ </p>
+ </Show>
+ </ViewSidebar.Nav>
+ </CollapsibleSection.Content>
+ </CollapsibleSection.Root>
+ </ViewSidebar.Content>
+ </ViewSidebar.Root>
+ </MaybeSoupEntityActionDrawerManager>
);
}
diff --git a/apps/web/src/features/soup/SoupEntityContextMenu.tsx b/apps/web/src/features/soup/SoupEntityContextMenu.tsx
index 2c6a84d1c4..5bb63ff80a 100644
--- a/apps/web/src/features/soup/SoupEntityContextMenu.tsx
+++ b/apps/web/src/features/soup/SoupEntityContextMenu.tsx
@@ -33,6 +33,8 @@ interface SoupEntityContextMenuProps {
selectedEntities: Accessor<EntityData[]>;
viewContext: EntityActionViewContext;
class?: string;
+ /** Use a div trigger when the row already renders its own button. */
+ as?: 'div';
onOpenChange?: (open: boolean) => void;
}
@@ -111,6 +113,7 @@ export const SoupEntityContextMenu: FlowComponent<
<Match when={true}>
<ContextMenu onOpenChange={props.onOpenChange}>
<ContextMenu.Trigger
+ as={props.as}
class={cn('size-full group/cm-trigger', props.class)}
on:contextmenu={(event: MouseEvent) =>
setMenuPosition({ x: event.clientX, y: event.clientY })
diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.md
index 15945f5875..0af079e84a 100644
--- a/docs/AGENT_GUIDE/ai-chat.md
+++ b/docs/AGENT_GUIDE/ai-chat.md
@@ -25,6 +25,8 @@
and Magic Chip). Until GitHub has synced the entity it opens GitHub in a new
tab. Either click leaves the session unopened. The leading icon reflects the PR status. Changing the composer mode does not filter the sidebar.
Selecting a row opens its own mode; Shift-click opens it in a new split.
+ Right-click (or long-press on mobile) opens the same entity menu as Home:
+ Rename, Favorite, Copy link, Share, Delete, and the other session actions.
- The starting page has a compact composer that starts at one line and grows
with longer prompts or Shift+Enter. Lists, quotes, headings, and other
non-paragraph blocks expand immediately, even with short text. This also applies
diff --git a/docs/AGENT_GUIDE/navigation.md b/docs/AGENT_GUIDE/navigation.md
index a6effc5af2..435d9f4e87 100644
--- a/docs/AGENT_GUIDE/navigation.md
+++ b/docs/AGENT_GUIDE/navigation.md
@@ -141,6 +141,8 @@ 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.
+Right-click a conversation for Rename, Favorite, Copy link, Share, Delete, and
+the other entity actions used on Home.
Home's inner rail starts with a full-width **New chat** plus button that returns
to Home's starting pane without creating a chat. Email and Tasks use the same