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
Add "Ask Macro" button to channel header for AI chat (#6317)
Jacob Beckerman48a51fbf928d
diff --git a/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx b/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsxindex 0b030a22be..bc2d8ba88e 100644--- a/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx+++ b/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx@@ -1,3 +1,8 @@+import {+ ChatWithAgentButton,+ ChatWithAgentIcon,+ openChatWithAgent,+} from '@app/features/chat/ChatWithAgentButton';import {makeRenameAction,useBlockEntityCommands,@@ -185,6 +190,19 @@ function NewTop(props: { channelId: string }) {});};+ // Seed for "Ask Macro": a new chat with this channel @mentioned, so the+ // user does not have to create an agent and mention the channel by hand.+ const askMacroEntity = () => {+ const type = channelType();+ if (!type) return undefined;+ return {+ type: 'channel' as const,+ id: props.channelId,+ name: channelName() ?? 'New Channel',+ channelType: type,+ };+ };+// Mobile has no room for inline tabs; the title file-menu drawer leads with// them instead, as a titled radio group mirroring the active tab. Built// from tabs() so the call tab keeps its live-call label.@@ -221,6 +239,17 @@ function NewTop(props: { channelId: string }) {entity={channelEntity()}mobileViews={isMobile() ? mobileViews() : undefined}tools={[+ {+ label: 'Ask Macro',+ icon: ChatWithAgentIcon,+ action: () => {+ const entity = askMacroEntity();+ if (!entity) return;+ void openChatWithAgent(entity);+ },+ // Desktop gets a header button instead (see below).+ condition: () => isMobile() && !!askMacroEntity(),+ },{group: 'file',label: 'Rename',@@ -239,6 +268,16 @@ function NewTop(props: { channelId: string }) {]}/></SplitTitleFileMenu>+ {/* Desktop only: on mobile the action lives in the title drawer above. */}+ <Show when={!isMobile() && askMacroEntity()}>+ {(entity) => (+ <SplitHeaderRight>+ <HeaderIsland>+ <ChatWithAgentButton entity={entity()} label="Ask Macro" />+ </HeaderIsland>+ </SplitHeaderRight>+ )}+ </Show>{/* Hidden once the user has joined — the call surface owns the UI. */}<Show when={ENABLE_CALLS && !call.isInThisChannel()}><SplitHeaderRight>diff --git a/apps/web/src/features/chat/ChatWithAgentButton.tsx b/apps/web/src/features/chat/ChatWithAgentButton.tsxindex 5047ae4316..678ce6e44f 100644--- a/apps/web/src/features/chat/ChatWithAgentButton.tsx+++ b/apps/web/src/features/chat/ChatWithAgentButton.tsx@@ -128,7 +128,11 @@ export async function openChatWithMessageReplacingSplit(await createAndOpenChat({ message, replaceSplit: splitHandle });}-export function ChatWithAgentButton(props: { entity: ChatWithAgentEntity }) {+export function ChatWithAgentButton(props: {+ entity: ChatWithAgentEntity;+ /** Button text; defaults to "Chat". */+ label?: string;+}) {const [hovering, setHovering] = createSignal(false);return (@@ -143,7 +147,7 @@ export function ChatWithAgentButton(props: { entity: ChatWithAgentEntity }) {class="bg-surface"><AnimatedStarIcon triggerAnimation={hovering()} />- <span class="text-xs">Chat</span>+ <span class="text-xs">{props.label ?? 'Chat'}</span></Button>);}diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.mdindex f60625ba74..4c9511996f 100644--- a/docs/AGENT_GUIDE/channels.md+++ b/docs/AGENT_GUIDE/channels.md@@ -122,7 +122,9 @@ their own loaded pages and load more as their active list approaches the end.## Channel tabsRadio group at the top of the channel pane: `Messages` / `Attachments` / `Participants`,-plus a `Call` button. Clicking the radio input can time out — click the adjacent label text+plus `Ask Macro` and `Call` buttons. `Ask Macro` opens a new chat pane with the channel+already @mentioned as context (see ai-chat.md). On mobile it lives in the channel title's+`...` drawer instead. Clicking the radio input can time out — click the adjacent label textinstead.`Participants` tab: