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
fix(bots): simplify setup and collapse advanced options (#8391)
Eric Hayesf9270aac569c
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex 289ee4cdd0..084d0aef23 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -78,6 +78,9 @@ without changing the active route. Backend registration still verifies accountownership. Cancel, logout, and the ten-minute timeout retire pending callbacks.### General+- Keep bot setup focused on the token-and-SDK workflow; Agent and Ownership+ controls live under collapsed Advanced settings. See the+ [Bots walkthrough](../../docs/agent-guide/settings.md#bots).- Label the notification permission toast **Enable Desktop Notifications** inthe desktop app and keep its Enable action on the native notification provider.- Keep signed-out Drive document routes on the shared detail viewer withoutdiff --git a/apps/web/src/features/channel/Bots/BotAdvancedSection.tsx b/apps/web/src/features/channel/Bots/BotAdvancedSection.tsxnew file mode 100644index 0000000000..20da4770c8--- /dev/null+++ b/apps/web/src/features/channel/Bots/BotAdvancedSection.tsx@@ -0,0 +1,33 @@+import CaretUpIcon from '@phosphor/caret-up.svg';+import { Button } from '@ui';+import { CollapseTransition } from '@ui/components/CollapseTransition';+import { createSignal, createUniqueId, type JSX } from 'solid-js';++export function BotAdvancedSection(props: { children: JSX.Element }) {+ const [open, setOpen] = createSignal(false);+ const contentId = createUniqueId();++ return (+ <div class="border-t border-edge-muted pt-3">+ <Button+ type="button"+ variant="ghost"+ class="w-full justify-between"+ aria-expanded={open()}+ aria-controls={contentId}+ onClick={() => setOpen((value) => !value)}+ >+ Advanced+ <CaretUpIcon+ class="transition-transform"+ classList={{ 'rotate-180': open() }}+ />+ </Button>+ <div id={contentId}>+ <CollapseTransition open={open()}>+ <div class="flex flex-col gap-5 pt-4">{props.children}</div>+ </CollapseTransition>+ </div>+ </div>+ );+}diff --git a/apps/web/src/features/channel/Bots/BotAgentSection.tsx b/apps/web/src/features/channel/Bots/BotAgentSection.tsxindex 4502c888d0..a0369d1d28 100644--- a/apps/web/src/features/channel/Bots/BotAgentSection.tsx+++ b/apps/web/src/features/channel/Bots/BotAgentSection.tsx@@ -3,10 +3,6 @@ import { Show } from 'solid-js';import { useChatV3AgentsFlag } from '../use-chat-v3-agents-flag';import { BotFormSection } from './BotFormSection';-/**- * The "Coding agent" toggle. Hidden entirely unless the chat v3 agents flag is- * on, so bots stay plain webhook bots for everyone else.- */export function BotAgentSection(props: {checked: boolean;disabled?: boolean;@@ -18,13 +14,15 @@ export function BotAgentSection(props: {<Show when={agentsEnabled()}><BotFormSectiontitle="Agent"- description="Turn this bot into a coding agent instead of a webhook responder."+ description="Make this bot available in the model selector when starting an AI chat."><div class="flex items-center justify-between gap-4"><div class="min-w-0">- <div class="text-sm font-medium text-ink">Agent Harness</div>+ <div class="text-sm font-medium text-ink">+ Show in model selector+ </div><p class="mt-0.5 text-xs text-ink-muted">- This bot manages an agent harness like Codex or Hermes+ Connect an agent such as Codex or Hermes to handle requests.</p></div><ToggleSwitch@@ -32,7 +30,7 @@ export function BotAgentSection(props: {checked={props.checked}disabled={props.disabled}onChange={props.onChange}- label={<span>Make this bot a coding agent</span>}+ label={<span>Show in model selector</span>}labelClass="sr-only"/></div>diff --git a/apps/web/src/features/channel/Bots/BotCreatePage.tsx b/apps/web/src/features/channel/Bots/BotCreatePage.tsxindex fae96487a6..8edc250a93 100644--- a/apps/web/src/features/channel/Bots/BotCreatePage.tsx+++ b/apps/web/src/features/channel/Bots/BotCreatePage.tsx@@ -16,6 +16,7 @@ import type { Bot } from '@service-storage/generated/schemas/bot';import { Button, ToggleSwitch } from '@ui';import { createMemo, createSignal, Show } from 'solid-js';import { createStore } from 'solid-js/store';+import { BotAdvancedSection } from './BotAdvancedSection';import { BotAgentSection } from './BotAgentSection';import { BotCreationResult } from './BotCreationResult';import { BotFormSection } from './BotFormSection';@@ -198,7 +199,9 @@ export function BotCreate(props: { channelId?: string; onBack: () => void }) {Create a bot</h1><p class="mt-0.5 text-sm text-ink-muted">- Give an integration a profile and a secure channel webhook.+ A bot is an account your program uses to read and send channel+ messages. Create one, add it to channels, then use the token we+ give you with the Macro SDK.</p></div></header>@@ -243,44 +246,9 @@ export function BotCreate(props: { channelId?: string; onBack: () => void }) {/></BotFormSection>- <BotAgentSection- checked={form.hasAgent}- disabled={pending()}- onChange={(checked) => setForm('hasAgent', checked)}- />-- <BotFormSection- title="Ownership"- description="Bots are personal by default."- >- <div class="flex items-center justify-between gap-4">- <div class="min-w-0">- <div class="text-sm font-medium text-ink">Team bot</div>- <p class="mt-0.5 text-xs text-ink-muted">- Share this bot with your team and let it use team scope.- </p>- </div>- <ToggleSwitch- size="md"- checked={teamOwned()}- disabled={currentTeamQuery.isLoading || !canCreateTeamBot()}- onChange={setTeamOwned}- label={<span>Create as a team bot</span>}- labelClass="sr-only"- />- </div>- <Show when={!currentTeamQuery.isLoading && !canCreateTeamBot()}>- <p class="mt-3 border-t border-edge-muted pt-3 text-xs text-ink-extra-muted">- {currentTeam()- ? 'Only team admins and owners can create team bots.'- : 'Join or create a team to create a team bot.'}- </p>- </Show>- </BotFormSection>-<BotFormSectiontitle="Channels"- description="Add the bot now to get ready-to-use webhook URLs."+ description="Choose the channels your program can access as this bot."><label class="mb-1.5 block text-xs font-medium">Add to channels <span class="text-ink-muted">· optional</span>@@ -295,9 +263,46 @@ export function BotCreate(props: { channelId?: string; onBack: () => void }) {</p></BotFormSection>+ <BotAdvancedSection>+ <BotAgentSection+ checked={form.hasAgent}+ disabled={pending()}+ onChange={(checked) => setForm('hasAgent', checked)}+ />++ <BotFormSection+ title="Ownership"+ description="You own the bot by default. Enable Mentionable to make it a team-owned bot."+ >+ <div class="flex items-center justify-between gap-4">+ <div class="min-w-0">+ <div class="text-sm font-medium text-ink">Mentionable</div>+ <p class="mt-0.5 text-xs text-ink-muted">+ Let teammates find and @mention this bot in channels.+ </p>+ </div>+ <ToggleSwitch+ size="md"+ checked={teamOwned()}+ disabled={currentTeamQuery.isLoading || !canCreateTeamBot()}+ onChange={setTeamOwned}+ label={<span>Mentionable</span>}+ labelClass="sr-only"+ />+ </div>+ <Show when={!currentTeamQuery.isLoading && !canCreateTeamBot()}>+ <p class="mt-3 border-t border-edge-muted pt-3 text-xs text-ink-extra-muted">+ {currentTeam()+ ? 'Only team admins and owners can create team bots.'+ : 'Join or create a team to create a team bot.'}+ </p>+ </Show>+ </BotFormSection>+ </BotAdvancedSection>+<div class="flex items-center justify-between gap-4 pt-1"><p class="text-xs text-ink-muted">- A webhook token is generated automatically.+ You’ll get a bot token after creation.</p><div class="flex shrink-0 gap-2"><Button type="button" variant="ghost" size="sm" onClick={leave}>@@ -317,7 +322,7 @@ export function BotCreate(props: { channelId?: string; onBack: () => void }) {<div><div class="text-sm font-medium">Creating your bot…</div><div class="mt-1 text-xs text-ink-muted">- Setting up its profile, channels, and webhook token.+ Setting up its profile, channels, and token.</div></div></div>diff --git a/apps/web/src/features/channel/Bots/BotCreationResult.tsx b/apps/web/src/features/channel/Bots/BotCreationResult.tsxindex c1f2099207..6fbb98d94e 100644--- a/apps/web/src/features/channel/Bots/BotCreationResult.tsx+++ b/apps/web/src/features/channel/Bots/BotCreationResult.tsx@@ -76,9 +76,9 @@ export function BotCreationResult(props: {{(token) => (<><CredentialField- label="Webhook token"+ label="Bot token"value={token()}- help="Send as x-macro-channel-bot-token"+ help="Use with the Macro SDK, or send as x-macro-channel-bot-token for webhooks."/><Show when={props.channels[0]}>{(channel) => (diff --git a/apps/web/src/features/channel/Bots/BotDetailPage.tsx b/apps/web/src/features/channel/Bots/BotDetailPage.tsxindex 7297d31ed5..3539d3155a 100644--- a/apps/web/src/features/channel/Bots/BotDetailPage.tsx+++ b/apps/web/src/features/channel/Bots/BotDetailPage.tsx@@ -18,6 +18,8 @@ import { useCurrentTeamQuery, useIsTeamOwner } from '@queries/team/teams';import { Button } from '@ui';import { createEffect, createMemo, createSignal, on, Show } from 'solid-js';import { createStore } from 'solid-js/store';+import { useChatV3AgentsFlag } from '../use-chat-v3-agents-flag';+import { BotAdvancedSection } from './BotAdvancedSection';import { BotAgentSection } from './BotAgentSection';import { BotAvatar } from './BotAvatar';import { BotDeleteDialog } from './BotDeleteDialog';@@ -39,6 +41,7 @@ import { CreateBotTokenDialog } from './CreateBotTokenDialog';import { createBotAvatarUpload } from './createBotAvatarUpload';export function BotDetail(props: { botId: string; onBack: () => void }) {+ const agentsEnabled = useChatV3AgentsFlag();const agentDm = ENABLE_AGENT_DMS ? useOpenAgentDm() : undefined;const channelsContext = useChannelsContext();const currentUserId = useUserId();@@ -301,12 +304,6 @@ export function BotDetail(props: { botId: string; onBack: () => void }) {/></BotFormSection>- <BotAgentSection- checked={form.hasAgent}- disabled={saving()}- onChange={(checked) => setForm('hasAgent', checked)}- />-<BotFormSectiontitle="Channels"description="Choose every channel this bot can post to."@@ -327,6 +324,16 @@ export function BotDetail(props: { botId: string; onBack: () => void }) {onNewToken={() => setTokenOpen(true)}/>+ <Show when={agentsEnabled()}>+ <BotAdvancedSection>+ <BotAgentSection+ checked={form.hasAgent}+ disabled={saving()}+ onChange={(checked) => setForm('hasAgent', checked)}+ />+ </BotAdvancedSection>+ </Show>+<BotDetailActionscanDelete={canDelete()}dirty={isDirty()}diff --git a/apps/web/src/features/settings/BotSettingsList.tsx b/apps/web/src/features/settings/BotSettingsList.tsxindex a1313d0312..2c25110fb4 100644--- a/apps/web/src/features/settings/BotSettingsList.tsx+++ b/apps/web/src/features/settings/BotSettingsList.tsx@@ -66,7 +66,7 @@ export function BotSettingsList(props: {return (<SettingsPagetitle="Bots"- description="Create webhook-powered teammates and connect them to channels."+ description="A bot is an account your program uses to read and send channel messages. Create a bot, add it to channels, then use its token with the Macro SDK to control it."actions={<Button variant="cta" size="sm" onClick={props.onCreate}><PlusIcon />@@ -76,7 +76,7 @@ export function BotSettingsList(props: {><SettingsSectiontitle="Your bots"- description="Each bot can join multiple channels. Webhook URLs are scoped to the channel."+ description="Manage your bots, their channels, and access tokens."><SettingsCard><Show@@ -98,8 +98,8 @@ export function BotSettingsList(props: {Create your first bot</div><div class="mt-1 max-w-80 text-xs text-ink-muted">- Bots post to channels through a secure webhook and can be- mentioned like any other participant.+ Give your program a name and profile in Macro. We’ll+ generate a token when you create the bot.</div><Buttonclass="mt-4"diff --git a/docs/agent-guide/settings.md b/docs/agent-guide/settings.mdindex 7a2fc4b86b..992dc83ff9 100644--- a/docs/agent-guide/settings.md+++ b/docs/agent-guide/settings.md@@ -565,3 +565,22 @@ and verify an upstream outage leaves the current links intact and reports an errThe Macro link survives a failed reconnect, but replacing the FusionAuth grantis not atomic. A crash or failed restoration may leave it missing; retry OAuthto recreate it after the provider recovers.++## Bots++Open **Developer → Bots** to create an account for a program. The page explains+how to add the bot to channels and use its token with the Macro SDK. **Create+bot** keeps Profile and Channels visible. **Advanced** starts collapsed on both+desktop and mobile and contains:++- **Agent → Show in model selector**: makes the bot available when starting an+ AI chat; connect an agent such as Codex or Hermes to handle requests. This+ section remains gated by the agents rollout.+- **Ownership → Mentionable**: lets teammates find and @mention the bot and+ creates it under team ownership. With the switch off, the creator owns it.+ Only team admins and owners can enable this option.++Open an existing bot to edit its profile, channels, and tokens. Its Agent control+also lives under a collapsed **Advanced** section. Verify that expanding and+collapsing Advanced preserves selected options and does not submit the form.+After creation, copy the **Bot token** before leaving; it is shown only once.