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.

feat(agents): unify Agents settings, runtimes, and Connections (#6779)

Wolf Mermelsteinddddcb44d4bd
diff --git a/apps/docs/AI/bring-your-own.mdx b/apps/docs/AI/bring-your-own.mdx
index b3a87a0f26..9a0f0a3cfe 100644
--- a/apps/docs/AI/bring-your-own.mdx
+++ b/apps/docs/AI/bring-your-own.mdx
@@ -1,123 +1,97 @@
---
title: "Bring your own agent"
-sidebarTitle: "Bring Your Own"
+sidebarTitle: "Bring your own agent"
icon: "terminal"
tag: "Coming soon"
-description: "Connect a self-hosted ACP agent harness to Macro with macrod."
+description: "Bring Claude Code, OpenCode, OpenClaw, or Hermes into your Macro workspace with macrod."
---
<Info>
Bring Your Own Agent will be available soon.
</Info>
-You can run any [Agent Client Protocol (ACP)](https://zed.dev/acp)-compatible agent harness directly in Macro.
+Use your local coding agent from Macro. `macrod` runs on your computer, connects your agent to Macro, and keeps its sessions available from your workspace.
-Macro provides `macrod`, a small daemon that runs on your computer and waits for agent sessions. When you @mention an agent that runs on your harness, `macrod` launches your configured harness, sends it the prompt, and bridges its ACP connection to Macro.
+## Agents and runtimes
-A harness can be **private** (only you can run agents on it) or **team** (any teammate can create agents that run on it).
+An **agent** combines a name, instructions, a default model, and a runtime. A **runtime** is the harness that powers it: Macro AI, a built-in coding harness, or an agent running on your own machine.
-<Warning>
- Self-hosted agents can run real commands on your computer. Anyone who can prompt an agent bound to your harness may be able to affect its configured workspace. Use a dedicated workspace, grant channel access carefully, and think twice before sharing a harness with your team.
-</Warning>
+Manage both in **Settings → General → Agents**. Connect your machine in **Runtimes**, then create an agent that uses it in **Agents**.
## Before you start
-You need:
+You need a macOS or Linux computer that can stay online and an installed, authenticated coding agent. `macrod` recognizes Claude Code, Codex, OpenCode, OpenClaw, and Hermes. You can also configure a custom command for an Agent Client Protocol (ACP) agent.
+
+`macrod` connects out to Macro. You do not need a public webhook endpoint, port forwarding, or an HTTPS tunnel.
-- A machine that can keep an agent harness and `macrod` running
-- An ACP-compatible harness installed and configured on that machine
-- A public HTTPS endpoint that forwards webhooks (in this demo, to port `8790`)
+<Warning>
+ Your local agent can run commands and edit files on your computer. Choose a dedicated workspace and review access before sharing a runtime with your team. Leave permission bypass off unless you intend to allow actions without approval.
+</Warning>
-<Tip>
- [Cloudflare Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/) can provide the HTTPS endpoint needed to receive webhooks without opening a router port. To use it, [install `cloudflared`](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/) and run `cloudflared tunnel --url http://localhost:8790`. Then copy the temporary `https://....trycloudflare.com` URL and append `/macro-events` for the `public_url` below.
-</Tip>
+## Connect your runtime
<Steps>
- <Step title="Prepare an agent harness">
- Install your preferred ACP-compatible agent and identify the command that starts its ACP server. Verify that command before configuring `macrod`.
+ <Step title="Install macrod">
+ Download the `macrod` archive for your operating system and architecture from [Macro releases](https://github.com/macro-inc/macro/releases), then extract it.
- These harnesses provide ACP entrypoints:
+ Open **Settings → General → Agents → Runtimes → New runtime** in Macro. The page walks you through installation, configuration, and pairing.
+ </Step>
- - **Claude Code:** `npx -y @agentclientprotocol/claude-agent-acp`
- - **Codex:** `npx -y @agentclientprotocol/codex-acp`
- - **Hermes:** `hermes-acp` (run `hermes-acp --check` first)
- - **OpenCode:** `opencode acp`
- - **OpenClaw:** `openclaw acp`
+ <Step title="Run macrod">
+ Open a terminal in the extracted folder and run:
- Claude Code and Codex require their linked adapter packages because the base `claude` and `codex` commands do not expose ACP servers directly.
- </Step>
+ ```bash
+ ./macrod
+ ```
- <Step title="Download macrod">
- Open the [latest Macro release](https://github.com/macro-inc/macro/releases/latest) and download the `macrod` archive for your OS and architecture. Currently, we officially support macOS and Linux.
- </Step>
+ Keep the terminal open while you use your runtime.
- <Step title="Start the HTTPS tunnel">
- `macrod` listens on port `8790` and receives requests at `POST /macro-events`. Macro must be able to reach that endpoint over public HTTPS.
+ On first launch, **Quickstart** lists the agents available on your machine. Select one, or choose **Custom command** to enter an ACP launch command.
- For the Cloudflare quick tunnel described above, run:
+ Set **Workspace** to the directory your agent should work in. Choose **Private** for your own runtime that only you can kick off, or **Team** to let teammates use your agent. If you run team mode, anyone can create agent sessions that run on your computer. By default, you'll be asked for permission requests based on the harness you run, such as for accessing files outside of your workspace; if you enable **Full Access** these prompts will automatically be approved.
- ```bash
- cloudflared tunnel --url http://localhost:8790
- ```
+ <Frame caption="Configure your agent, workspace, and access before generating a pairing code.">
+ ![The macrod Quickstart configuration screen showing discovered agents, workspace, access, Full Access off, and the Create and pair button](/images/macrod-quickstart-example.png)
+ </Frame>
- Keep this process running and copy the URL it prints.
+ Select **Create and pair** to generate your device code.
<Note>
- A quick-tunnel URL changes whenever `cloudflared` restarts. Create a [named Cloudflare tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-local-tunnel/) for a stable endpoint.
+ Claude Code and Codex use ACP adapters. Their presets require the agent's command, `npm`, and `npx` to be available in the shell where you start `macrod`.
</Note>
-
- Alternatively, you can port-forward or deploy your harness to a cloud server.
</Step>
- <Step title="Configure macrod">
- Create `macro.toml` beside the `macrod` binary. No tokens or account details go here - identity comes from pairing in the next step.
-
- ```toml
- [macro]
- api_url = "https://gateway.macro.com/agent-harness"
- storage_url = "https://gateway.macro.com/dss"
+ <Step title="Enter your pairing code">
+ The **Pair macrod** panel shows a device code and a link to Macro. If you are already in the terminal overview, press <kbd>p</kbd> to open pairing. Press <kbd>c</kbd> to copy the code.
- [identity]
- # Optional: how this machine shows up in Settings. Defaults to its hostname.
- name = "my-macbook"
+ Open the pairing link, or go to **Settings → General → Agents → Runtimes → New runtime**. Enter your code and click **Look up**.
- [server]
- port = 8790
- public_url = "https://example.trycloudflare.com/macro-events"
+ <Frame caption="Example only—enter the code from your own macrod terminal.">
+ ![The macrod terminal with a device code and approval link in the Pair macrod panel](/images/macrod-pairing-example.png)
+ </Frame>
- [harness]
- command = "your-acp-agent"
- args = []
+ Check that the code and computer match your terminal. Review the runtime name, **Private** or **Team** access, and permissions, then click **Approve**.
- [workspace]
- path = "/absolute/path/to/your/repository"
- repo_url = "https://github.com/you/your-repository"
- ```
-
- Set `command` and `args` to the ACP launch command from the first step.
+ `macrod` connects automatically after approval. It saves your configuration and credential in `macrod.toml` in the directory where you started it. Keep this file private; do not commit it to a repository.
</Step>
+</Steps>
- <Step title="Pair the daemon">
- Start `macrod` from a shell where your harness command is available:
+## Create an agent that uses your runtime
- ```bash
- ./macrod --config ./macro.toml
- ```
+Return to the **Agents** tab and click **New agent**. Give your agent a name and instructions, choose your connected machine under **Runtime**, and select a default model.
- On first run it prints a pairing code and a link into Macro's **Settings → Harness** page. Open the link, confirm the code matches, choose **Private** or **Team**, and approve. `macrod` picks the credential up automatically and saves it to `macro.credentials.json` next to the config.
+Review sharing and channel access, then save the agent. @mention it in a channel it can access to start a session on your machine.
- To pair again later (for example after revoking the harness), run `./macrod login`.
- </Step>
+## Keep your runtime connected
- <Step title="Create an agent on your harness">
- Open **Settings → Agents → New agent** and pick your harness under **Harness**. If the harness is shared with your team, teammates can do the same.
+Leave `macrod` running and your computer awake while you use the runtime. Its terminal shows your sessions, configuration, and logs. You can also check the runtime in **Settings → General → Agents → Runtimes**.
- Then @mention the agent in a channel it can reach. `macrod` opens the session and your local harness answers.
- </Step>
-</Steps>
+To reconnect later, run `macrod` from the same directory so it loads your saved configuration. If you revoke the runtime, pair it again before using it.
-## Keep it connected
+## Troubleshooting
-Both `macrod` and your HTTPS tunnel must stay running for you to start self-hosted agent sessions from Macro. The **Settings → Harness** page shows whether your daemon is currently connected.
+- **Your agent is missing from Quickstart:** check that it is installed and its command is available in the terminal where you launch `macrod`. For a different ACP agent, use **Custom command**.
+- **Your code is invalid or expired:** start a new pairing from the terminal and enter the new code. The code in the screenshot is only an example.
+- **Your runtime is offline:** check that your computer is awake, `macrod` is running, and it can reach Macro. Check the terminal's **Logs** tab for errors.
-To stop a harness for good, remove it from **Settings → Harness**; that revokes its credential, and the daemon will tell you to run `macrod login` if you start it again.
+To learn more about using agents in your workspace, see [Agents](/product/agents).
diff --git a/apps/docs/images/macrod-pairing-example.png b/apps/docs/images/macrod-pairing-example.png
new file mode 100644
index 0000000000..7e7b3bf964
Binary files /dev/null and b/apps/docs/images/macrod-pairing-example.png differ
diff --git a/apps/docs/images/macrod-quickstart-example.png b/apps/docs/images/macrod-quickstart-example.png
new file mode 100644
index 0000000000..a813cd61dd
Binary files /dev/null and b/apps/docs/images/macrod-quickstart-example.png differ
diff --git a/apps/web/src/features/agents-view/components/ArtifactDialog.tsx b/apps/web/src/features/agents-view/components/ArtifactDialog.tsx
deleted file mode 100644
index 0b92de4b35..0000000000
--- a/apps/web/src/features/agents-view/components/ArtifactDialog.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { type JSX, onCleanup, onMount } from 'solid-js';
-import { Portal } from 'solid-js/web';
-import { useDataMode } from '../context/data-mode';
-
-/**
- * The design's dialog: a dimmed overlay and a raised panel, rendered through
- * a portal that carries the view's tokens and mode. Escape, a click on the
- * overlay, or any `data-close` control inside closes it; the first field
- * takes focus.
- */
-export function ArtifactDialog(props: {
- /** Extra panel classes: `narrow`, `wide`, `xwide`, `fixed`. */
- class?: string;
- label: string;
- onClose: () => void;
- children: JSX.Element;
-}) {
- const mode = useDataMode();
- let panel: HTMLDivElement | undefined;
-
- onMount(() => {
- const onKeyDown = (event: KeyboardEvent) => {
- if (event.key !== 'Escape') return;
- event.stopPropagation();
- props.onClose();
- };
- document.addEventListener('keydown', onKeyDown);
- onCleanup(() => document.removeEventListener('keydown', onKeyDown));
- queueMicrotask(() =>
- panel
- ?.querySelector<HTMLElement>(
- 'input:not([type="file"]), textarea, select'
- )
- ?.focus()
- );
- });
-
- return (
- <Portal>
- <div class="agents-view-portal" data-mode={mode()}>
- <div
- class="overlay"
- onClick={(event) => {
- if (event.target === event.currentTarget) props.onClose();
- }}
- >
- <div
- ref={panel}
- class={props.class ? `dialog ${props.class}` : 'dialog'}
- role="dialog"
- aria-modal="true"
- aria-label={props.label}
- onClick={(event) => {
- const target = event.target as HTMLElement;
- if (target.closest('[data-close]')) props.onClose();
- }}
- >
- {props.children}
- </div>
- </div>
- </div>
- </Portal>
- );
-}
diff --git a/apps/web/src/features/agents-view/components/Segmented.tsx b/apps/web/src/features/agents-view/components/Segmented.tsx
deleted file mode 100644
index 814986fee7..0000000000
--- a/apps/web/src/features/agents-view/components/Segmented.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-import LockIcon from '@phosphor/lock-simple.svg';
-import TeamIcon from '@phosphor/users-three.svg';
-import { For, Show } from 'solid-js';
-
-type SegmentIcon = 'lock' | 'team';
-
-export type SegmentOption<T extends string> = {
- value: T;
- label: string;
- icon?: SegmentIcon;
- disabled?: boolean;
-};
-
-/** The design's compact segmented control (`.segc`): one pressed segment. */
-export function Segmented<T extends string>(props: {
- name: string;
- value: T;
- options: SegmentOption<T>[];
- onChange: (value: T) => void;
- large?: boolean;
-}) {
- return (
- <span
- class={props.large ? 'segc lg' : 'segc'}
- data-seg={props.name}
- role="radiogroup"
- aria-label={props.name}
- >
- <For each={props.options}>
- {(option) => (
- <button
- type="button"
- role="radio"
- aria-checked={props.value === option.value}
- aria-pressed={props.value === option.value}
- disabled={option.disabled}
- title={option.disabled ? 'Create or join a team first' : undefined}
- onClick={() => props.onChange(option.value)}
- >
- <Show when={option.icon === 'lock'}>
- <LockIcon class="ph" />
- </Show>
- <Show when={option.icon === 'team'}>
- <TeamIcon class="ph" />
- </Show>
- {option.label}
- </button>
- )}
- </For>
- </span>
- );
-}
diff --git a/apps/web/src/features/agents-view/components/SimpleDialogs.tsx b/apps/web/src/features/agents-view/components/SimpleDialogs.tsx
deleted file mode 100644
index 0c77a1483b..0000000000
--- a/apps/web/src/features/agents-view/components/SimpleDialogs.tsx
+++ /dev/null
@@ -1,132 +0,0 @@
-import TrashIcon from '@phosphor/trash.svg';
-import XIcon from '@phosphor/x.svg';
-import { createSignal, type JSX, Show } from 'solid-js';
-import { ArtifactDialog } from './ArtifactDialog';
-
-/** Rename a conversation or agent in place. */
-export function RenameDialog(props: {
- title?: string;
- value: string;
- pending?: boolean;
- onRename: (value: string) => void;
- onClose: () => void;
-}) {
- const [value, setValue] = createSignal(props.value);
- const submit = () => {
- const next = value().trim();
- if (!next || props.pending) return;
- props.onRename(next);
- };
-
- return (
- <ArtifactDialog
- class="narrow"
- label={props.title ?? 'Rename'}
- onClose={props.onClose}
- >
- <div class="dh" style={{ height: '40px', padding: '0 8px 0 12px' }}>
- <span class="t" style={{ 'font-weight': 600 }}>
- {props.title ?? 'Rename'}
- </span>
- <button type="button" class="icon-btn" aria-label="Close" data-close>
- <XIcon class="ph" />
- </button>
- </div>
- <div class="db">
- <input
- class="sinput"
- aria-label="Name"
- value={value()}
- onInput={(event) => setValue(event.currentTarget.value)}
- onKeyDown={(event) => {
- if (event.key === 'Enter') {
- event.preventDefault();
- submit();
- }
- }}
- onFocus={(event) => event.currentTarget.select()}
- />
- </div>
- <div class="df">
- <button type="button" class="btn outline" data-close>
- Cancel
- </button>
- <button
- type="button"
- class="btn"
- style={{
- background: 'var(--accent)',
- color: 'var(--accent-contrast)',
- }}
- disabled={props.pending || value().trim().length === 0}
- onClick={submit}
- >
- {props.pending ? 'Renaming…' : 'Rename'}
- </button>
- </div>
- </ArtifactDialog>
- );
-}
-
-/** A yes/no question before something irreversible. */
-export function ConfirmDialog(props: {
- title: string;
- body: JSX.Element;
- confirmLabel: string;
- pendingLabel?: string;
- pending?: boolean;
- danger?: boolean;
- onConfirm: () => void;
- onClose: () => void;
-}) {
- return (
- <ArtifactDialog class="narrow" label={props.title} onClose={props.onClose}>
- <div class="dh" style={{ height: '40px', padding: '0 8px 0 12px' }}>
- <span class="t" style={{ 'font-weight': 600 }}>
- {props.title}
- </span>
- <button type="button" class="icon-btn" aria-label="Close" data-close>
- <XIcon class="ph" />
- </button>
- </div>
- <div class="db">
- <p
- style={{
- margin: 0,
- 'font-size': '13.5px',
- 'line-height': 1.5,
- color: 'var(--ink-muted)',
- }}
- >
- {props.body}
- </p>
- </div>
- <div class="df">
- <button type="button" class="btn outline" data-close>
- Cancel
- </button>
- <button
- type="button"
- class={props.danger ? 'btn danger' : 'btn'}
- style={
- props.danger
- ? undefined
- : {
- background: 'var(--accent)',
- color: 'var(--accent-contrast)',
- }
- }
- disabled={props.pending}
- onClick={props.onConfirm}
- >
- <Show when={props.danger}>
- <TrashIcon class="ph" />
- </Show>
- {props.pending
- ? (props.pendingLabel ?? 'Working…')
- : props.confirmLabel}
- </button>
- </div>
- </ArtifactDialog>
- );
-}
diff --git a/apps/web/src/features/agents-view/core/links.ts b/apps/web/src/features/agents-view/core/links.ts
deleted file mode 100644
index 6b010207e0..0000000000
--- a/apps/web/src/features/agents-view/core/links.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/** Where the bring-your-own-agent (macrod) setup is documented. */
-export const BYOA_DOCS_URL = 'https://docs.macro.com/AI/bring-your-own';
-
-/** The coding agents macrod can bring to Macro, as the roster page names them. */
-export const BYOA_AGENTS = [
- 'Claude Code',
- 'Codex',
- 'OpenCode',
- 'Hermes',
- 'OpenClaw',
-];
diff --git a/apps/web/src/features/agents-view/queries/connected-runtimes.ts b/apps/web/src/features/agents-view/queries/connected-runtimes.ts
deleted file mode 100644
index 5c46e3db34..0000000000
--- a/apps/web/src/features/agents-view/queries/connected-runtimes.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import { MACRO_HARNESS_NAME } from '@core/constant/macroAgent';
-import {
- type AgentModelTarget,
- buildAgentModelTargets,
-} from '@queries/agents/models';
-import type { Harness } from '@service-storage/client';
-
-/** A runtime an agent can be bound to, with the model-discovery target for it. */
-export type ConnectedRuntime = {
- id: string;
- name: string;
- kind: 'builtin' | 'macrod';
- target: AgentModelTarget;
- connected: boolean;
-};
-
-/**
- * Every runtime the editor can offer, in display order: Macro's harness,
- * Cursor when the caller has connected it, then each paired macrod daemon.
- */
-export function connectedRuntimes(
- cursorConnected: boolean,
- harnesses: readonly Harness[]
-): ConnectedRuntime[] {
- // Claude Cloud remains in Settings; this workspace offers its existing runtimes.
- return buildAgentModelTargets(cursorConnected, harnesses, false).map(
- (target) => {
- if (target.harness === 'in-memory') {
- return {
- id: 'in-memory',
- name: MACRO_HARNESS_NAME,
- kind: 'builtin',
- target,
- connected: true,
- };
- }
- if (target.harness === 'cursor') {
- return {
- id: 'cursor',
- name: 'Cursor',
- kind: 'builtin',
- target,
- connected: true,
- };
- }
- const harness = harnesses.find(
- (candidate) => candidate.id === target.harnessId
- );
- return {
- id: target.harnessId ?? '',
- name: harness
- ? harness.owner.type === 'team'
- ? `${harness.name} · Team`
- : harness.name
- : 'macrod',
- kind: 'macrod',
- target,
- connected: harness?.connected ?? false,
- };
- }
- );
-}
diff --git a/apps/web/src/features/agents-view/views/AgentEditorDialog.tsx b/apps/web/src/features/agents-view/views/AgentEditorDialog.tsx
deleted file mode 100644
index aff81a7602..0000000000
--- a/apps/web/src/features/agents-view/views/AgentEditorDialog.tsx
+++ /dev/null
@@ -1,735 +0,0 @@
-import { botAssignableChannelOptions } from '@app/features/channel/Bots/botChannelOptions';
-import {
- addMcpServer,
- catalogEntryToMcpServer,
- removeMcpServer,
-} from '@app/features/settings/agentMcpServers';
-import { useChannelsContext } from '@core/context/channels';
-import { PipedreamConnectorIcon } from '@core/pipedream/ConnectorIcon';
-import { createPipedreamCatalogSearch } from '@core/pipedream/catalog';
-import { usePipedreamMcpFlag } from '@core/pipedream/flag';
-import MacroLogo from '@icon/macro-logo.svg';
-import CursorIcon from '@icon/wide-cursor-ide.svg';
-import CheckIcon from '@phosphor/check.svg';
-import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';
-import PlugsIcon from '@phosphor/plugs.svg';
-import PlusIcon from '@phosphor/plus.svg';
-import TrashIcon from '@phosphor/trash.svg';
-import XIcon from '@phosphor/x.svg';
-import type {
- AgentWithHarnessId,
- CreateAgentParams,
-} from '@queries/agents/agents';
-import { useAgentModelsQueries } from '@queries/agents/models';
-import { usePipedreamConnectedSlugs } from '@queries/pipedream-connectors';
-import type { AgentMcpServer } from '@service-storage/generated/schemas/agentMcpServer';
-import type { AgentMcpServers } from '@service-storage/generated/schemas/agentMcpServers';
-import { createMemo, createSignal, For, Match, Show, Switch } from 'solid-js';
-import { AgentIcon, CodeMark } from '../components/AgentGlyph';
-import { ArtifactDialog } from '../components/ArtifactDialog';
-import { Segmented } from '../components/Segmented';
-import { type AgentKind, isCoderHarness } from '../core/agent-kind';
-import type { ConnectedRuntime } from '../queries/connected-runtimes';
-
-function slugTag(value: string): string {
- return value
- .toLowerCase()
- .replace(/^@/, '')
- .replace(/[^a-z0-9_-]+/g, '-')
- .replace(/^-+|-+$/g, '');
-}
-
-/**
- * Create or edit an agent: identity and settings on the left, instructions
- * on the right. A coder is an agent bound to a coding runtime, so the Coder
- * switch decides whether the Runtime list shows and what the save sends.
- */
-export function AgentEditorDialog(props: {
- agent?: AgentWithHarnessId;
- initialKind: AgentKind;
- runtimes: readonly ConnectedRuntime[];
- currentTeamId?: string;
- canShareWithTeam: boolean;
- canMakePrivate: boolean;
- pending: boolean;
- onClose: () => void;
- onSave: (agent: CreateAgentParams) => Promise<boolean>;
- onDelete?: () => void;
-}) {
- const isNew = () => props.agent === undefined;
- const coderRuntimes = () =>
- props.runtimes.filter((runtime) => runtime.id !== 'in-memory');
- const [coder, setCoder] = createSignal(
- props.agent
- ? isCoderHarness(props.agent.harness)
- : props.initialKind === 'coder'
- );
- const noun = () => (coder() ? 'coding agent' : 'agent');
- const [name, setName] = createSignal(props.agent?.bot.name ?? '');
- const [tag, setTag] = createSignal(props.agent?.bot.handle ?? '');
- const [tagEdited, setTagEdited] = createSignal(props.agent !== undefined);
- const [avatarUrl, setAvatarUrl] = createSignal<string | undefined>(
- props.agent?.bot.avatar_url ?? undefined
- );
- const [instructions, setInstructions] = createSignal(
- props.agent?.instructions ?? ''
- );
- const [harnessId, setHarnessId] = createSignal(
- props.agent?.harness_id ??
- props.agent?.harness ??
- (coder() ? coderRuntimes()[0]?.id : 'in-memory') ??
- ''
- );
- let avatarInput: HTMLInputElement | undefined;
-
- // Model discovery per runtime, so switching runtimes swaps the catalog.
- const modelQueries = useAgentModelsQueries(() =>
- props.runtimes.map((runtime) => runtime.target)
- );
- const runtime = () =>
- props.runtimes.find((candidate) => candidate.id === harnessId());
- const modelQueryFor = (id: string) => {
- const index = props.runtimes.findIndex((candidate) => candidate.id === id);
- return index >= 0 ? modelQueries[index] : undefined;
- };
- const modelDataFor = (id: string) => {
- const query = modelQueryFor(id);
- return query?.isSuccess ? query.data : undefined;
- };
- const preferredModelId = (id: string) => {
- const data = modelDataFor(id);
- if (data?.status === 'unsupported') return 'default';
- if (data?.status !== 'available') return '';
- const current = data.currentModel;
- if (
- current &&
- (data.models.length === 0 ||
- data.models.some((model) => model.id === current))
- ) {
- return current;
- }
- return data.models[0]?.id ?? '';
- };
- const [defaultModelId, setDefaultModelId] = createSignal(
- props.agent?.default_model ?? ''
- );
- const selectedDefaultModelId = () =>
- defaultModelId() || preferredModelId(harnessId());
- const modelOptions = () => {
- const data = modelDataFor(harnessId());
- if (data?.status !== 'available') return [];
- const selected = selectedDefaultModelId();
- const saved =
- props.agent?.default_model === selected &&
- (props.agent.harness_id ?? props.agent.harness) === harnessId();
- if (!selected || data.models.some((model) => model.id === selected)) {
- return data.models;
- }
- return [
- ...data.models,
- {
- id: selected,
- name: `${selected} (${saved ? 'saved, ' : ''}unavailable)`,
- description: undefined,
- group: undefined,
- },
- ];
- };
-
- const changeRuntime = (id: string) => {
- setHarnessId(id);
- setDefaultModelId(preferredModelId(id));
- };
- const setCoderMode = (on: boolean) => {
- if (on && coderRuntimes().length === 0) return;
- setCoder(on);
- changeRuntime(on ? (coderRuntimes()[0]?.id ?? '') : 'in-memory');
- };
-
- const [channelMode, setChannelMode] = createSignal<'all' | 'selected'>(
- props.agent?.channel_scope ?? 'all'
- );
- const [selectedChannelIds, setSelectedChannelIds] = createSignal<string[]>(
- props.agent?.channel_ids ?? []
- );
- const channelsContext = useChannelsContext();
- const channels = createMemo(() =>
- botAssignableChannelOptions(channelsContext.channels())
- );
- const toggleChannel = (id: string) =>
- setSelectedChannelIds((current) =>
- current.includes(id)
- ? current.filter((value) => value !== id)
- : [...current, id]
- );
-
- const [share, setShare] = createSignal<'private' | 'team'>(
- props.agent?.bot.owner?.type === 'team' ? 'team' : 'private'
- );
-
- const pipedreamMcp = usePipedreamMcpFlag();
- const connections = usePipedreamConnectedSlugs();
- const [mcp, setMcp] = createSignal<AgentMcpServers>(
- props.agent?.mcp ?? { scope: 'owner_connections' }
- );
- const picked = (): AgentMcpServer[] => {
- const current = mcp();
- return current.scope === 'selected' ? current.servers : [];
- };
- // Picks survive a round trip through "All my MCPs", so comparing the two
- // does not throw the list away.
- let remembered: AgentMcpServer[] = picked();
- const setMcpScope = (scope: AgentMcpServers['scope']) => {
- if (scope === 'selected')
- setMcp({ scope: 'selected', servers: remembered });
- else {
- remembered = picked();
- setMcp({ scope: 'owner_connections' });
- }
- };
- const setPicked = (servers: AgentMcpServer[]) => {
- remembered = servers;
- setMcp({ scope: 'selected', servers });
- };
- const pickedSlugs = createMemo<ReadonlySet<string>>(
- () => new Set(picked().map((server) => server.app_slug))
- );
- const catalog = createPipedreamCatalogSearch(pickedSlugs);
-
- const handleNameInput = (value: string) => {
- setName(value);
- if (!tagEdited()) setTag(slugTag(value));
- };
- const handleAvatar = (file: File | undefined) => {
- if (!file) return;
- const reader = new FileReader();
- reader.addEventListener('load', () => {
- if (typeof reader.result === 'string') setAvatarUrl(reader.result);
- });
- reader.readAsDataURL(file);
- };
-
- const canSave = () =>
- !props.pending &&
- name().trim().length > 0 &&
- tag().trim().length > 0 &&
- runtime() !== undefined &&
- selectedDefaultModelId().length > 0 &&
- (channelMode() === 'all' || selectedChannelIds().length > 0) &&
- (mcp().scope === 'owner_connections' || picked().length > 0) &&
- (share() === 'private' ? props.canMakePrivate : props.canShareWithTeam);
-
- const submit = async () => {
- const current = runtime();
- if (!canSave() || !current) return;
- const owner = props.agent?.bot.owner;
- const saved = await props.onSave({
- avatarUrl: avatarUrl(),
- channelIds: channelMode() === 'all' ? [] : selectedChannelIds(),
- channelScope: channelMode(),
- defaultModel: selectedDefaultModelId(),
- handle: slugTag(tag()),
- // Paired macrod runtimes send the 'macrod' slug plus their uuid;
- // built-ins send their own slug with no runtime id.
- harness: current.kind === 'macrod' ? 'macrod' : current.id,
- harnessId: current.kind === 'macrod' ? current.id : undefined,
- name: name().trim(),
- instructions: instructions().trim(),
- mcp: mcp(),
- teamId:
- share() === 'team'
- ? owner?.type === 'team'
- ? owner.team_id
- : props.currentTeamId
- : undefined,
- });
- if (saved) props.onClose();
- };
-
- const glyphAgent = () => ({
- id: props.agent?.bot.id ?? 'new',
- name: name() || 'Agent',
- });
-
- return (
- <ArtifactDialog
- class="xwide fixed"
- label={`${isNew() ? 'Create' : 'Edit'} ${noun()}`}
- onClose={props.onClose}
- >
- <div class="dh">
- <span class="t">
- <AgentIcon agent={glyphAgent()} />
- {isNew() ? 'Create' : 'Edit'} {noun()}
- </span>
- <span class="hr">
- <Segmented
- name="share"
- value={share()}
- options={[
- {
- value: 'private',
- label: 'Private',
- icon: 'lock',
- disabled: !props.canMakePrivate,
- },
- {
- value: 'team',
- label: 'Team',
- icon: 'team',
- disabled: !props.canShareWithTeam,
- },
- ]}
- onChange={setShare}
- />
- <button type="button" class="icon-btn" aria-label="Close" data-close>
- <XIcon class="ph" />
- </button>
- </span>
- </div>
- <div class="db">
- <div class="cols agent">
- <div class="colL">
- <div class="avrow" style={{ border: 0, padding: 0 }}>
- <span class="avw">
- <button
- type="button"
- class="bigav"
- aria-label="Change avatar"
- onClick={() => avatarInput?.click()}
- >
- <Show
- when={avatarUrl()}
- fallback={<AgentIcon agent={glyphAgent()} />}
- >
- {(url) => (
- <img
- src={url()}
- alt=""
- style={{
- width: '100%',
- height: '100%',
- 'object-fit': 'cover',
- 'border-radius': 'inherit',
- }}
- />
- )}
- </Show>
- </button>
- <CodeMark hidden={!coder()} />
- </span>
- <input
- ref={avatarInput}
- type="file"
- accept="image/*"
- hidden
- onChange={(event) =>
- handleAvatar(event.currentTarget.files?.[0])
- }
- />
- <div style={{ 'min-width': 0, flex: 1 }}>
- <input
- class="sinput"
- aria-label="Agent name"
- placeholder="Agent name"
- style={{ 'font-weight': 500 }}
- value={name()}
- onInput={(event) =>
- handleNameInput(event.currentTarget.value)
- }
- />
- <span class="tagin" style={{ 'margin-top': '6px' }}>
- <span class="at">@</span>
- <input
- aria-label="@tag"
- placeholder="tag"
- value={tag()}
- onInput={(event) => {
- setTagEdited(true);
- setTag(slugTag(event.currentTarget.value));
- }}
- />
- </span>
- </div>
- </div>
-
- <Show when={coder()}>
- <div class="divider" />
- <p class="grp-h">Runtime</p>
- <div class="plist" role="radiogroup" aria-label="Runtime">
- <For
- each={coderRuntimes()}
- fallback={
- <p class="empty">
- Connect Cursor or pair a runtime, then come back.
- </p>
- }
- >
- {(candidate) => (
- <button
- type="button"
- class="prow"
- role="radio"
- aria-checked={harnessId() === candidate.id}
- onClick={() => changeRuntime(candidate.id)}
- >
- <span class="cb rd" />
- <Show
- when={candidate.kind === 'macrod'}
- fallback={
- <Show
- when={candidate.id === 'cursor'}
- fallback={<MacroLogo class="ph" />}
- >
- <CursorIcon class="ph" />
- </Show>
- }
- >
- <PlugsIcon class="ph" />
- </Show>
- <span class="truncate">{candidate.name}</span>
- <span class="meta">
- <Show
- when={candidate.kind === 'macrod'}
- fallback={
- candidate.id === 'cursor' ? 'cloud' : 'built in'
- }
- >
- <span class={candidate.connected ? 'on' : 'off'}>
- {candidate.connected ? 'Connected' : 'Disconnected'}
- </span>
- </Show>
- </span>
- </button>
- )}
- </For>
- </div>
- </Show>
-
- <div class="srow">
- <span class="lab">Default model</span>
- <Show
- when={modelQueryFor(harnessId())}
- fallback={
- <span class="sinput sm" style={{ color: 'var(--ink-muted)' }}>
- Model discovery unavailable
- </span>
- }
- >
- {(query) => (
- <Switch>
- <Match when={query().isPending}>
- <select
- class="sinput sm"
- aria-label="Default model"
- disabled
- >
- <option>Loading models…</option>
- </select>
- </Match>
- <Match when={query().isError}>
- <span
- style={{ 'font-size': '12px', color: 'var(--red)' }}
- >
- Could not load models.{' '}
- <button
- type="button"
- class="link-btn"
- onClick={() => void query().refetch()}
- >
- Retry
- </button>
- </span>
- </Match>
- <Match
- when={modelDataFor(harnessId())?.status !== 'available'}
- >
- <span
- class="sinput sm"
- style={{ color: 'var(--ink-muted)' }}
- >
- Chosen by the runtime
- </span>
- </Match>
- <Match when={true}>
- <select
- class="sinput sm"
- aria-label="Default model"
- value={selectedDefaultModelId()}
- onChange={(event) =>
- setDefaultModelId(event.currentTarget.value)
- }
- >
- <For each={modelOptions()}>
- {(model) => (
- <option value={model.id}>{model.name}</option>
- )}
- </For>
- </select>
- </Match>
- </Switch>
- )}
- </Show>
- </div>
-
- <Show when={pipedreamMcp()}>
- <div class="divider" />
- <div class="grp-row">
- <p class="grp-h">Connections</p>
- <Segmented
- name="mcp"
- value={mcp().scope}
- options={[
- { value: 'owner_connections', label: 'All my MCPs' },
- { value: 'selected', label: 'Specific MCPs' },
- ]}
- onChange={setMcpScope}
- />
- </div>
- <Show
- when={mcp().scope === 'selected'}
- fallback={
- <p
- style={{
- margin: 0,
- 'font-size': '12px',
- color: 'var(--ink-disabled)',
- }}
- >
- The agent can use every app the person running it has
- connected.
- </p>
- }
- >
- <div class="picker">
- <div class="csearch">
- <MagnifyingGlassIcon class="ph" />
- <input
- placeholder="Search all connectors…"
- aria-label="Search connectors"
- value={catalog.searchInput()}
- onInput={(event) =>
- catalog.onSearchInput(event.currentTarget.value)
- }
- />
- </div>
- <Show when={catalog.searchInput().trim().length > 0}>
- <div class="results" aria-label="Connector results">
- <Show
- when={
- !catalog.query.isPending &&
- catalog.entries().length === 0
- }
- >
- <div class="empty">No connectors match.</div>
- </Show>
- <For each={catalog.entries()}>
- {(entry) => (
- <button
- type="button"
- class="crow"
- onClick={() => {
- setPicked(
- addMcpServer(
- picked(),
- catalogEntryToMcpServer(entry)
- )
- );
- catalog.onSearchInput('');
- }}
- >
- <span class="mk">
- <PipedreamConnectorIcon
- appSlug={entry.app_slug}
- class="size-4"
- />
- </span>
- <span style={{ 'min-width': 0 }}>
- <span class="nm truncate">
- {entry.display_name}
- </span>
- <span class="ds truncate">
- {entry.description}
- </span>
- </span>
- <span class="add">
- <PlusIcon class="ph" />
- </span>
- </button>
- )}
- </For>
- </div>
- </Show>
- <div class="picked">
- <For
- each={picked()}
- fallback={
- <p class="none">
- No apps picked yet. Search above to add one — you can
- connect your account later.
- </p>
- }
- >
- {(server) => (
- <div class="crow">
- <span class="mk">
- <PipedreamConnectorIcon
- appSlug={server.app_slug}
- class="size-5"
- />
- </span>
- <span style={{ 'min-width': 0 }}>
- <span class="nm truncate">
- {server.server_name}
- </span>
- <span class="ds truncate">
- {connections.ready()
- ? connections.slugs().has(server.app_slug)
- ? 'Connected'
- : 'Not connected'
- : ''}
- </span>
- </span>
- <button
- type="button"
- class="icon-btn"
- aria-label={`Remove ${server.server_name}`}
- onClick={() =>
- setPicked(
- removeMcpServer(picked(), server.app_slug)
- )
- }
- >
- <XIcon class="ph" />
- </button>
- </div>
- )}
- </For>
- </div>
- </div>
- </Show>
- </Show>
-
- <div class="divider" />
- <div class="grp-row">
- <p class="grp-h">Channels</p>
- <Segmented
- name="ch"
- value={channelMode()}
- options={[
- { value: 'all', label: 'All channels' },
- { value: 'selected', label: 'Specific' },
- ]}
- onChange={setChannelMode}
- />
- </div>
- <Show when={channelMode() === 'selected'}>
- <div class="plist scroll" aria-label="Channels">
- <For
- each={channels()}
- fallback={<p class="empty">No channels to pick from.</p>}
- >
- {(channel) => (
- <button
- type="button"
- class="prow"
- role="checkbox"
- aria-checked={selectedChannelIds().includes(channel.id)}
- onClick={() => toggleChannel(channel.id)}
- >
- <span class="cb">
- <CheckIcon class="ph" />
- </span>
- <span class="mk">#</span>
- <span class="truncate">{channel.name}</span>
- <span class="meta" />
- </button>
- )}
- </For>
- </div>
- </Show>
-
- <div class="divider" />
- <div class="srow">
- <span class="lab">
- Coding agent
- <small>
- {coderRuntimes().length === 0
- ? 'Connect Cursor or pair a runtime to make coding agents'
- : 'Writes code: takes a repository, runs on a runtime, and appears under Coding agents'}
- </small>
- </span>
- <button
- type="button"
- class="switch"
- role="switch"
- aria-checked={coder()}
- aria-disabled={
- coderRuntimes().length === 0 && !coder() ? true : undefined
- }
- style={
- coderRuntimes().length === 0 && !coder()
- ? { opacity: 0.7 }
- : undefined
- }
- onClick={() => setCoderMode(!coder())}
- >
- <span class="trk" />
- <span class="sw-l">{coder() ? 'On' : 'Off'}</span>
- </button>
- </div>
- </div>
-
- <div class="colR">
- <div class="mdwrap">
- <div class="mdbar">
- <span class="lbl">Instructions</span>
- </div>
- <textarea
- class="always"
- aria-label="Instructions"
- spellcheck={false}
- placeholder="You are…"
- value={instructions()}
- onInput={(event) => setInstructions(event.currentTarget.value)}
- />
- </div>
- </div>
- </div>
- </div>
- <div class="df">
- <Show when={!isNew() && props.onDelete} fallback={<span />}>
- {(onDelete) => (
- <button type="button" class="btn danger" onClick={onDelete()}>
- <TrashIcon class="ph" />
- Delete <span class="noun">{noun()}</span>
- </button>
- )}
- </Show>
- <div style={{ display: 'flex', gap: '8px' }}>
- <button type="button" class="btn quiet" data-close>
- Cancel
- </button>
- <button
- type="button"
- class="btn"
- style={{
- background: 'var(--accent)',
- color: 'var(--accent-contrast)',
- }}
- disabled={!canSave()}
- onClick={() => void submit()}
- >
- {props.pending
- ? isNew()
- ? 'Creating…'
- : 'Saving…'
- : isNew()
- ? `Create ${noun()}`
- : 'Save changes'}
- </button>
- </div>
- </div>
- </ArtifactDialog>
- );
-}
diff --git a/apps/web/src/features/agents-view/views/AgentsView.tsx b/apps/web/src/features/agents-view/views/AgentsView.tsx
index 5a5628ff55..4d4cb7ca98 100644
--- a/apps/web/src/features/agents-view/views/AgentsView.tsx
+++ b/apps/web/src/features/agents-view/views/AgentsView.tsx
@@ -1,6 +1,7 @@
import { ViewShell } from '@app/components/view-shell';
import { startPendingSession } from '@app/features/block-agent/context/pending-session';
import { QUERY_FILTERS_BASE } from '@app/features/next-soup/filters/query-filters';
+import { AgentSettings } from '@app/features/settings/AgentSettings';
import { McpConnections } from '@app/features/settings/McpConnections';
import { withEntityNotifications } from '@app/features/soup/entity-notifications';
import {
@@ -17,21 +18,7 @@ import { toast } from '@core/component/Toast/Toast';
import { useUserId } from '@core/context/user';
import { ListEntityMetadataQueryProvider } from '@entity';
import SpinnerIcon from '@phosphor/spinner.svg';
-import {
- type AgentWithHarnessId,
- type CreateAgentParams,
- useCreateAgentMutation,
- useDeleteAgentMutation,
- useUpdateAgentMutation,
-} from '@queries/agents/agents';
-import { useCursorApiKeyStatusQuery } from '@queries/auth/cursor-api-key';
-import {
- useDeleteHarnessMutation,
- useHarnessesQuery,
-} from '@queries/harnesses/harnesses';
import { useSoupItemsQuery } from '@queries/soup/items';
-import { useCurrentTeamQuery } from '@queries/team/teams';
-import type { Harness } from '@service-storage/client';
import {
createEffect,
createMemo,
@@ -46,7 +33,6 @@ import {
import '../agents-view.css';
import { AgentSessionPane } from '../components/AgentSessionPane';
import { AgentsSidebar } from '../components/AgentsSidebar';
-import { ConfirmDialog } from '../components/SimpleDialogs';
import { Topbar } from '../components/Topbar';
import { DataModeProvider, dataModeFor } from '../context/data-mode';
import { type AgentKind, modeForKind } from '../core/agent-kind';
@@ -62,19 +48,13 @@ import {
import { kindForBot } from '../core/roster';
import { type AgentsRoute, agentsRouteId } from '../core/route';
import { createAgentRosterSource } from '../queries/agent-roster-source';
-import { connectedRuntimes } from '../queries/connected-runtimes';
-import { AgentEditorDialog } from './AgentEditorDialog';
import { NewChatPage, type StartConversation } from './NewChatPage';
-import { PairRuntimeDialog } from './PairRuntimeDialog';
-import { RosterPage } from './RosterPage';
type SelectedConversation = {
conversation: AgentConversationTarget;
activeConversationId: string;
};
-type EditorState = { agent?: AgentWithHarnessId; kind: AgentKind };
-
function LoadingComposer() {
return (
<div class="grid size-full place-items-center text-ink-muted">
@@ -95,7 +75,6 @@ function AgentsWorkspace(props: { initialRoute?: AgentsRoute }) {
const mode = (): AgentsMode => props.initialRoute?.mode ?? 'chat';
const dataMode = () => dataModeFor(mode());
const [page, setPage] = createSignal<AgentsPage>('new');
- const [rosterKind, setRosterKind] = createSignal<AgentKind>('agent');
const [selected, setSelected] = createSignal<
SelectedConversation | undefined
>(
@@ -107,29 +86,7 @@ function AgentsWorkspace(props: { initialRoute?: AgentsRoute }) {
: undefined
);
const [search, setSearch] = createSignal('');
- const [editor, setEditor] = createSignal<EditorState>();
- const [deletingAgent, setDeletingAgent] = createSignal<AgentWithHarnessId>();
- const [pairing, setPairing] = createSignal(false);
- const [removingRuntime, setRemovingRuntime] = createSignal<Harness>();
-
const rosterSource = createAgentRosterSource();
- const harnessesQuery = useHarnessesQuery();
- const cursorStatus = useCursorApiKeyStatusQuery();
- const currentTeamQuery = useCurrentTeamQuery();
- const createAgent = useCreateAgentMutation();
- const updateAgent = useUpdateAgentMutation();
- const deleteAgent = useDeleteAgentMutation();
- const deleteHarness = useDeleteHarnessMutation();
- const cursorConnected = () =>
- cursorStatus.isSuccess ? cursorStatus.data.registered : false;
- const runtimes = () =>
- connectedRuntimes(
- cursorConnected(),
- harnessesQuery.isSuccess ? harnessesQuery.data : []
- );
- const currentTeamId = () =>
- currentTeamQuery.isSuccess ? currentTeamQuery.data?.team.id : undefined;
-
const query = useSoupItemsQuery(
() => {
const ownerId = userId();
@@ -210,9 +167,8 @@ function AgentsWorkspace(props: { initialRoute?: AgentsRoute }) {
}
)
);
- const openRoster = (kind: AgentKind) => {
+ const openRoster = (_kind: AgentKind) => {
setSelected(undefined);
- setRosterKind(kind);
setPage('agents');
};
const openConversation = (
@@ -276,57 +232,6 @@ function AgentsWorkspace(props: { initialRoute?: AgentsRoute }) {
return { ...current, activeConversationId: sessionId };
});
};
- const saveAgent = async (params: CreateAgentParams): Promise<boolean> => {
- const current = editor();
- try {
- if (current?.agent) {
- await updateAgent.mutateAsync({
- ...params,
- agentId: current.agent.bot.id,
- ...(current.agent.bot.description
- ? { description: current.agent.bot.description }
- : {}),
- });
- toast.success('Agent updated');
- } else {
- await createAgent.mutateAsync(params);
- toast.success('Agent created');
- }
- return true;
- } catch {
- toast.failure(
- current?.agent ? 'Failed to update agent' : 'Failed to create agent'
- );
- return false;
- }
- };
- const removeAgent = async () => {
- const current = deletingAgent();
- if (!current) return;
- try {
- await deleteAgent.mutateAsync({
- agentId: current.bot.id,
- channelIds: current.channel_ids,
- });
- setDeletingAgent(undefined);
- setEditor(undefined);
- toast.success('Agent deleted');
- } catch {
- toast.failure('Failed to delete agent');
- }
- };
- const removeRuntime = async () => {
- const current = removingRuntime();
- if (!current) return;
- try {
- await deleteHarness.mutateAsync({ harnessId: current.id });
- setRemovingRuntime(undefined);
- toast.success('Runtime removed');
- } catch {
- toast.failure('Failed to remove runtime');
- }
- };
-
const pageTitle = () => {
if (page() === 'agents') return 'Agents';
if (page() === 'connections') return 'Connections';
@@ -399,24 +304,7 @@ function AgentsWorkspace(props: { initialRoute?: AgentsRoute }) {
<McpConnections />
</Match>
<Match when={page() === 'agents'}>
- <RosterPage
- kind={rosterKind()}
- onKindChange={setRosterKind}
- onClose={showComposer}
- onCreate={(kind) => setEditor({ kind })}
- onEdit={(agent) =>
- setEditor({
- agent,
- kind:
- agent.harness === 'in-memory'
- ? 'agent'
- : 'coder',
- })
- }
- onDelete={setDeletingAgent}
- onPairRuntime={() => setPairing(true)}
- onRemoveRuntime={setRemovingRuntime}
- />
+ <AgentSettings />
</Match>
<Match when={true}>
<NewChatPage
@@ -477,59 +365,6 @@ function AgentsWorkspace(props: { initialRoute?: AgentsRoute }) {
</ViewShell.Main>
</ViewShell.Root>
</div>
-
- <Show when={editor()} keyed>
- {(state) => (
- <AgentEditorDialog
- agent={state.agent}
- initialKind={state.kind}
- runtimes={runtimes()}
- currentTeamId={currentTeamId()}
- canShareWithTeam={currentTeamId() !== undefined}
- canMakePrivate={
- state.agent?.bot.owner?.type !== 'team' ||
- state.agent.bot.created_by === userId()
- }
- pending={createAgent.isPending || updateAgent.isPending}
- onClose={() => setEditor(undefined)}
- onSave={saveAgent}
- onDelete={
- state.agent ? () => setDeletingAgent(state.agent) : undefined
- }
- />
- )}
- </Show>
- <Show when={deletingAgent()} keyed>
- {(agent) => (
- <ConfirmDialog
- title={`Delete ${agent.bot.name}?`}
- body="This removes the agent from every channel and permanently deletes its configuration. This action cannot be undone."
- confirmLabel="Delete agent"
- pendingLabel="Deleting…"
- danger
- pending={deleteAgent.isPending}
- onConfirm={() => void removeAgent()}
- onClose={() => setDeletingAgent(undefined)}
- />
- )}
- </Show>
- <Show when={pairing()}>
- <PairRuntimeDialog onClose={() => setPairing(false)} />
- </Show>
- <Show when={removingRuntime()} keyed>
- {(harness) => (
- <ConfirmDialog
- title={`Remove ${harness.name}?`}
- body="Agents using this runtime will stop running until it is reconnected. macrod on that machine will need to pair again."
- confirmLabel="Remove runtime"
- pendingLabel="Removing…"
- danger
- pending={deleteHarness.isPending}
- onConfirm={() => void removeRuntime()}
- onClose={() => setRemovingRuntime(undefined)}
- />
- )}
- </Show>
</DataModeProvider>
</SplitPanel.Body>
</SplitPanel.Root>
diff --git a/apps/web/src/features/agents-view/views/PairRuntimeDialog.tsx b/apps/web/src/features/agents-view/views/PairRuntimeDialog.tsx
deleted file mode 100644
index 6083de65e9..0000000000
--- a/apps/web/src/features/agents-view/views/PairRuntimeDialog.tsx
+++ /dev/null
@@ -1,219 +0,0 @@
-import { toast } from '@core/component/Toast/Toast';
-import { ThrownResultError } from '@core/util/result';
-import PlugsIcon from '@phosphor/plugs.svg';
-import XIcon from '@phosphor/x.svg';
-import {
- useApproveHarnessPairingMutation,
- useHarnessPairingQuery,
-} from '@queries/harnesses/harnesses';
-import { useCurrentTeamQuery } from '@queries/team/teams';
-import { createSignal, Show } from 'solid-js';
-import { ArtifactDialog } from '../components/ArtifactDialog';
-import { Segmented } from '../components/Segmented';
-
-const PAIRING_ERROR =
- 'This pairing code is invalid, expired, or already claimed.';
-
-function failureMessage(error: unknown, fallback: string): string {
- return (error instanceof ThrownResultError && error.message) || fallback;
-}
-
-/** `kx7m4qhd` → `KX7M-4QHD`, at most eight characters. */
-function formatCode(raw: string): string {
- const chars = raw
- .toUpperCase()
- .replace(/[^A-Z0-9]/g, '')
- .slice(0, 8);
- return chars.length > 4 ? `${chars.slice(0, 4)}-${chars.slice(4)}` : chars;
-}
-
-function expiresIn(expiresAt: string): string {
- const minutes = Math.max(
- 0,
- Math.round((new Date(expiresAt).getTime() - Date.now()) / 60_000)
- );
- return minutes === 1 ? 'in 1 minute' : `in ${minutes} minutes`;
-}
-
-/**
- * Approves a macrod pairing request: the code the daemon printed, a name for
- * the runtime, and who may run agents on it.
- */
-export function PairRuntimeDialog(props: { onClose: () => void }) {
- const [code, setCode] = createSignal('');
- const [name, setName] = createSignal('');
- const [nameEdited, setNameEdited] = createSignal(false);
- const [share, setShare] = createSignal<'private' | 'team'>('private');
- const [error, setError] = createSignal<string>();
- const complete = () => code().length === 9;
- const pairingQuery = useHarnessPairingQuery(() =>
- complete() ? code() : undefined
- );
- const approve = useApproveHarnessPairingMutation();
- const currentTeamQuery = useCurrentTeamQuery();
- const teamId = () =>
- currentTeamQuery.isSuccess ? currentTeamQuery.data?.team.id : undefined;
- const pairing = () =>
- pairingQuery.isSuccess ? pairingQuery.data : undefined;
- const lookupError = () =>
- complete() && pairingQuery.isError
- ? failureMessage(pairingQuery.error, PAIRING_ERROR)
- : undefined;
- const requestedName = () => {
- const details = pairing();
- return details && !nameEdited() ? details.requested_name : name();
- };
- const canApprove = () =>
- !!pairing() &&
- requestedName().trim().length > 0 &&
- !approve.isPending &&
- (share() === 'private' || teamId() !== undefined);
-
- const submit = async () => {
- const details = pairing();
- if (!details || !canApprove()) return;
- setError(undefined);
- try {
- await approve.mutateAsync({
- code: details.code,
- name: requestedName().trim(),
- teamId: share() === 'team' ? teamId() : undefined,
- });
- toast.success('Runtime paired');
- props.onClose();
- } catch (cause) {
- setError(failureMessage(cause, PAIRING_ERROR));
- }
- };
-
- return (
- <ArtifactDialog
- class="narrow"
- label="Pair a runtime"
- onClose={props.onClose}
- >
- <div class="dh">
- <span class="t">
- <PlugsIcon class="ph" />
- Pair a runtime
- </span>
- <button type="button" class="icon-btn" aria-label="Close" data-close>
- <XIcon class="ph" />
- </button>
- </div>
- <div class="db" style={{ gap: '16px' }}>
- <p
- style={{
- margin: 0,
- 'font-size': '13.5px',
- color: 'var(--ink-muted)',
- 'line-height': 1.5,
- }}
- >
- On the machine running your agent, start{' '}
- <code
- class="mono"
- style={{
- background: 'var(--surface-3)',
- padding: '1px 5px',
- 'border-radius': '4px',
- color: 'var(--ink)',
- }}
- >
- macrod
- </code>{' '}
- and press <code class="mono">p</code> to pair. It prints an
- 8-character code that is valid for 15 minutes. Enter it here to
- approve the pairing.
- </p>
- <div class="paircode">
- <input
- placeholder="XXXX-XXXX"
- maxlength={9}
- autocomplete="off"
- spellcheck={false}
- aria-label="Pairing code"
- value={code()}
- onInput={(event) => {
- setError(undefined);
- setCode(formatCode(event.currentTarget.value));
- }}
- />
- </div>
- <div class="grid2">
- <label class="field">
- <span>Name</span>
- <input
- class="sinput"
- placeholder="e.g. wolf-laptop"
- value={requestedName()}
- onInput={(event) => {
- setNameEdited(true);
- setName(event.currentTarget.value);
- }}
- />
- </label>
- <div class="field">
- <span>Share</span>
- <Segmented
- name="scope"
- value={share()}
- options={[
- { value: 'private', label: 'Private', icon: 'lock' },
- {
- value: 'team',
- label: 'Team',
- icon: 'team',
- disabled: teamId() === undefined,
- },
- ]}
- onChange={setShare}
- />
- </div>
- </div>
- <div class="kv" style={{ 'grid-template-columns': 'auto 1fr' }}>
- <span class="k">host</span>
- <span class="mono">
- {pairing()?.host ??
- (complete()
- ? pairingQuery.isPending
- ? 'looking up code…'
- : '—'
- : 'waiting for code…')}
- </span>
- <span class="k">expires</span>
- <span class="mono">
- {pairing() ? expiresIn(pairing()!.expires_at) : '—'}
- </span>
- </div>
- <Show when={error() ?? lookupError()}>
- {(message) => (
- <p style={{ margin: 0, 'font-size': '12px', color: 'var(--red)' }}>
- {message()}
- </p>
- )}
- </Show>
- </div>
- <div class="df">
- <span />
- <div style={{ display: 'flex', gap: '8px' }}>
- <button type="button" class="btn quiet" data-close>
- Cancel
- </button>
- <button
- type="button"
- class="btn"
- disabled={!canApprove()}
- style={{
- background: 'var(--accent)',
- color: 'var(--accent-contrast)',
- }}
- onClick={() => void submit()}
- >
- {approve.isPending ? 'Approving…' : 'Approve pairing'}
- </button>
- </div>
- </div>
- </ArtifactDialog>
- );
-}
diff --git a/apps/web/src/features/agents-view/views/RosterPage.tsx b/apps/web/src/features/agents-view/views/RosterPage.tsx
deleted file mode 100644
index 988dbbf34c..0000000000
--- a/apps/web/src/features/agents-view/views/RosterPage.tsx
+++ /dev/null
@@ -1,610 +0,0 @@
-import { botAssignableChannelOptions } from '@app/features/channel/Bots/botChannelOptions';
-import {
- canDeleteBot,
- canManageAgent,
-} from '@app/features/channel/Bots/botPermissions';
-import {
- MODEL_PRETTYNAME,
- type Model,
-} from '@core/component/AI/constant/model';
-import { toast } from '@core/component/Toast/Toast';
-import {
- CURSOR_BOT_HANDLE,
- CURSOR_BOT_ID,
- CURSOR_BOT_NAME,
-} from '@core/constant/cursorAgent';
-import {
- MACRO_AGENT_BOT_ID,
- MACRO_AGENT_HANDLE,
- MACRO_AGENT_NAME,
- MACRO_HARNESS_NAME,
-} from '@core/constant/macroAgent';
-import { useSettingsState } from '@core/constant/SettingsState';
-import { useChannelsContext } from '@core/context/channels';
-import { useUserId } from '@core/context/user';
-import MacroLogo from '@icon/macro-logo.svg';
-import CursorIcon from '@icon/wide-cursor-ide.svg';
-import CodeIcon from '@phosphor/code.svg';
-import CopyIcon from '@phosphor/copy.svg';
-import GearIcon from '@phosphor/gear.svg';
-import PencilIcon from '@phosphor/pencil-simple.svg';
-import PlugsIcon from '@phosphor/plugs.svg';
-import PlusIcon from '@phosphor/plus.svg';
-import RobotIcon from '@phosphor/robot.svg';
-import TrashIcon from '@phosphor/trash.svg';
-import XIcon from '@phosphor/x.svg';
-import {
- type AgentWithHarnessId,
- useAgentsQuery,
-} from '@queries/agents/agents';
-import { useCursorApiKeyStatusQuery } from '@queries/auth/cursor-api-key';
-import { useHarnessesQuery } from '@queries/harnesses/harnesses';
-import { useCurrentTeamQuery, useIsTeamOwner } from '@queries/team/teams';
-import type { Harness } from '@service-storage/client';
-import {
- createMemo,
- createSignal,
- For,
- type JSX,
- onCleanup,
- onMount,
- Show,
-} from 'solid-js';
-import { AgentAvatar } from '../components/AgentGlyph';
-import { type AgentKind, kindForHarness } from '../core/agent-kind';
-import { relativeAge } from '../core/format-age';
-import { BYOA_AGENTS, BYOA_DOCS_URL } from '../core/links';
-import { runtimeLabel } from '../core/roster';
-
-const KIND = {
- agent: {
- title: 'Agents',
- desc: 'Create agents with their own identity, instructions, and skills.',
- cta: 'Create agent',
- empty: 'No agents here yet.',
- },
- coder: {
- title: 'Coding agents',
- desc: 'Agents that write code. They take a repository and run on a runtime you configure below.',
- cta: 'Create coding agent',
- empty: 'No coding agents here yet. Create one, or pair a runtime below.',
- },
-} as const satisfies Record<AgentKind, Record<string, string>>;
-
-type Row = {
- id: string;
- name: string;
- handle: string;
- avatarUrl?: string;
- kind: AgentKind;
- share: 'system' | 'team' | 'private';
- runtime: string;
- model: string;
- channels: string;
- agent?: AgentWithHarnessId;
- canEdit: boolean;
- canDelete: boolean;
-};
-
-const MACRO_ROW: Row = {
- id: MACRO_AGENT_BOT_ID,
- name: MACRO_AGENT_NAME,
- handle: MACRO_AGENT_HANDLE,
- kind: 'agent',
- share: 'system',
- runtime: MACRO_HARNESS_NAME,
- model: 'Default model',
- channels: 'All channels',
- canEdit: false,
- canDelete: false,
-};
-
-function cursorRow(connected: boolean): Row {
- return {
- id: CURSOR_BOT_ID,
- name: CURSOR_BOT_NAME,
- handle: CURSOR_BOT_HANDLE,
- kind: 'coder',
- share: 'system',
- runtime: connected ? 'Cursor' : 'Cursor · not connected',
- model: 'Cursor default',
- channels: 'All channels',
- canEdit: false,
- canDelete: false,
- };
-}
-
-/**
- * The settings-style roster inside the workspace: agents on one tab, coders
- * and their runtimes on the other. Editing happens in dialogs the host opens.
- */
-export function RosterPage(props: {
- kind: AgentKind;
- onKindChange: (kind: AgentKind) => void;
- onClose: () => void;
- onCreate: (kind: AgentKind) => void;
- onEdit: (agent: AgentWithHarnessId) => void;
- onDelete: (agent: AgentWithHarnessId) => void;
- onPairRuntime: () => void;
- onRemoveRuntime: (harness: Harness) => void;
-}) {
- const { openSettings } = useSettingsState();
- const userId = useUserId();
- const agentsQuery = useAgentsQuery();
- const harnessesQuery = useHarnessesQuery();
- const cursorStatus = useCursorApiKeyStatusQuery();
- const currentTeamQuery = useCurrentTeamQuery();
- const isTeamOwner = useIsTeamOwner();
- const channelsContext = useChannelsContext();
- const cursorConnected = () =>
- cursorStatus.isSuccess ? cursorStatus.data.registered : false;
- const harnesses = () => (harnessesQuery.isSuccess ? harnessesQuery.data : []);
- const teamId = () =>
- currentTeamQuery.isSuccess ? currentTeamQuery.data?.team.id : undefined;
- const channelOptions = createMemo(() =>
- botAssignableChannelOptions(channelsContext.channels())
- );
-
- const rows = createMemo((): Row[] =>
- (agentsQuery.isSuccess ? agentsQuery.data : []).map((agent) => {
- const selected = channelOptions()
- .filter((channel) => agent.channel_ids.includes(channel.id))
- .map((channel) => `#${channel.name}`);
- return {
- id: agent.bot.id,
- name: agent.bot.name,
- handle: agent.bot.handle,
- avatarUrl: agent.bot.avatar_url ?? undefined,
- kind: kindForHarness(agent.harness),
- share: agent.bot.owner?.type === 'team' ? 'team' : 'private',
- runtime: runtimeLabel(
- agent.harness,
- agent.harness_id ?? undefined,
- harnesses()
- ),
- model:
- MODEL_PRETTYNAME[agent.default_model as Model] ?? agent.default_model,
- channels:
- agent.channel_scope === 'all'
- ? 'All channels'
- : selected.length > 0
- ? selected.join(', ')
- : `${agent.channel_ids.length} selected ${agent.channel_ids.length === 1 ? 'channel' : 'channels'}`,
- agent,
- canEdit: canManageAgent(agent.bot, userId(), teamId()),
- canDelete: canDeleteBot(agent.bot, userId(), teamId(), isTeamOwner()),
- };
- })
- );
- const of = (kind: AgentKind, share: Row['share']) =>
- rows().filter((row) => row.kind === kind && row.share === share);
- const teamAgents = () => [MACRO_ROW, ...of('agent', 'team')];
- const privateAgents = () => of('agent', 'private');
- const teamCoders = () => [
- cursorRow(cursorConnected()),
- ...of('coder', 'team'),
- ];
- const privateCoders = () => of('coder', 'private');
- const agentCount = () => teamAgents().length + privateAgents().length;
- const coderCount = () => teamCoders().length + privateCoders().length;
- const copy = () => KIND[props.kind];
-
- onMount(() => {
- const onKeyDown = (event: KeyboardEvent) => {
- if (event.key !== 'Escape') return;
- // An open dialog owns Escape.
- if (document.querySelector('.agents-view-portal .overlay')) return;
- props.onClose();
- };
- document.addEventListener('keydown', onKeyDown);
- onCleanup(() => document.removeEventListener('keydown', onKeyDown));
- });
-
- const copyGuideLink = async () => {
- try {
- await navigator.clipboard.writeText(BYOA_DOCS_URL);
- toast.success('Link copied to clipboard');
- } catch {
- toast.failure('Could not copy the link');
- }
- };
-
- return (
- <section class="page settings" data-active aria-label="Agents">
- <div class="wrap">
- <button
- type="button"
- class="icon-btn page-close"
- aria-label="Close"
- title="Close (esc)"
- onClick={props.onClose}
- >
- <XIcon class="ph" />
- </button>
- <header class="ph-head">
- <div>
- <h1 class="big">{copy().title}</h1>
- <p class="desc">{copy().desc}</p>
- </div>
- <button
- type="button"
- class="cta"
- onClick={() => props.onCreate(props.kind)}
- >
- <PlusIcon class="ph" />
- <span>{copy().cta}</span>
- </button>
- </header>
- <div class="tabs" role="tablist" aria-label="Agent kind">
- <button
- type="button"
- role="tab"
- aria-selected={props.kind === 'agent'}
- onClick={() => props.onKindChange('agent')}
- >
- <RobotIcon class="ph" />
- Agents
- <span class="n">{agentCount()}</span>
- </button>
- <button
- type="button"
- role="tab"
- aria-selected={props.kind === 'coder'}
- onClick={() => props.onKindChange('coder')}
- >
- <CodeIcon class="ph" />
- Coding agents
- <span class="n">{coderCount()}</span>
- </button>
- </div>
-
- <Show when={props.kind === 'agent'}>
- <div class="sections" data-kind="agents" role="tabpanel">
- <Section
- title="Team agents"
- description="Agents shared with your team, including Macro."
- >
- <Rows
- rows={teamAgents()}
- empty={KIND.agent.empty}
- loading={agentsQuery.isPending}
- onEdit={props.onEdit}
- onDelete={props.onDelete}
- />
- </Section>
- <Section
- title="Private agents"
- description="Agents owned by you rather than your team."
- >
- <Rows
- rows={privateAgents()}
- empty={KIND.agent.empty}
- loading={agentsQuery.isPending}
- onEdit={props.onEdit}
- onDelete={props.onDelete}
- />
- </Section>
- </div>
- </Show>
-
- <Show when={props.kind === 'coder'}>
- <div class="sections" data-kind="coders" role="tabpanel">
- <Section
- title="Team coding agents"
- description="Coding agents shared with your team."
- >
- <Rows
- rows={teamCoders()}
- empty={KIND.coder.empty}
- loading={agentsQuery.isPending}
- onEdit={props.onEdit}
- onDelete={props.onDelete}
- />
- </Section>
- <Section
- title="Private coding agents"
- description="Coding agents owned by you rather than your team."
- >
- <Rows
- rows={privateCoders()}
- empty={KIND.coder.empty}
- loading={agentsQuery.isPending}
- onEdit={props.onEdit}
- onDelete={props.onDelete}
- />
- </Section>
- <Section
- title="Runtimes"
- description="Where coding agents run. Built-in runtimes are always available; paired runtimes come and go with your machine."
- card={false}
- >
- <div class="scard runtimes">
- <div id="runtimeList">
- <RuntimeRow
- icon={<MacroLogo class="ph" />}
- name={MACRO_HARNESS_NAME}
- badge="system"
- sub="Built in · runs in Macro's cloud"
- connected
- status="Connected"
- >
- <button
- type="button"
- class="icon-btn"
- aria-label={`Configure ${MACRO_HARNESS_NAME}`}
- onClick={() => openSettings('Harness')}
- >
- <GearIcon class="ph" />
- </button>
- </RuntimeRow>
- <RuntimeRow
- icon={<CursorIcon class="ph" />}
- name="Cursor"
- badge="system"
- sub={
- cursorConnected()
- ? 'Cloud agents · connected with your Cursor API key'
- : 'Cloud agents · connect with your Cursor API key'
- }
- connected={cursorConnected()}
- status={cursorConnected() ? 'Connected' : 'Not connected'}
- >
- <button
- type="button"
- class="icon-btn"
- aria-label="Configure Cursor"
- onClick={() => openSettings('Harness')}
- >
- <GearIcon class="ph" />
- </button>
- </RuntimeRow>
- <For each={harnesses()}>
- {(harness) => (
- <RuntimeRow
- icon={<PlugsIcon class="ph" />}
- name={harness.name}
- badge={
- harness.owner.type === 'team' ? 'team' : 'private'
- }
- sub={`macrod · paired ${relativeAge(Date.parse(harness.created_at))}`}
- connected={harness.connected}
- status={
- harness.connected
- ? 'Connected'
- : harness.last_connected_at
- ? `Disconnected · seen ${relativeAge(Date.parse(harness.last_connected_at))}`
- : 'Disconnected · never seen'
- }
- >
- <button
- type="button"
- class="icon-btn neg"
- aria-label={`Remove ${harness.name}`}
- style={{ color: 'var(--red)' }}
- onClick={() => props.onRemoveRuntime(harness)}
- >
- <TrashIcon class="ph" />
- </button>
- </RuntimeRow>
- )}
- </For>
- </div>
- <div class="byoa footer">
- <div>
- <h2>
- <PlugsIcon class="ph" />
- <span>
- Bring your <RotatingWord /> to Macro
- </span>
- </h2>
- <p>
- Run it on your own machine and give it a seat in Macro.
- Pair once with <code>macrod</code>; after that it can be
- @mentioned in channels and started from here like any
- other agent. Works with any agent that speaks ACP.
- </p>
- </div>
- <div class="side">
- <button
- type="button"
- class="cta"
- style={{ 'justify-content': 'center' }}
- onClick={props.onPairRuntime}
- >
- <PlugsIcon class="ph" />
- Pair a runtime
- </button>
- <div class="snippet">
- <span title={BYOA_DOCS_URL}>{BYOA_DOCS_URL}</span>
- <button
- type="button"
- class="icon-btn"
- aria-label="Copy guide link"
- onClick={() => void copyGuideLink()}
- >
- <CopyIcon class="ph" />
- </button>
- </div>
- <a
- class="link-btn"
- style={{ 'justify-content': 'center' }}
- href={BYOA_DOCS_URL}
- target="_blank"
- rel="noopener noreferrer"
- >
- Read the macrod guide
- </a>
- </div>
- </div>
- </div>
- </Section>
- </div>
- </Show>
- </div>
- </section>
- );
-}
-
-function Section(props: {
- title: string;
- description: string;
- card?: boolean;
- children: JSX.Element;
-}) {
- return (
- <div class="section">
- <div class="sh">
- <h2>{props.title}</h2>
- <p>{props.description}</p>
- </div>
- <Show when={props.card !== false} fallback={props.children}>
- <div class="scard">{props.children}</div>
- </Show>
- </div>
- );
-}
-
-function Rows(props: {
- rows: Row[];
- empty: string;
- loading: boolean;
- onEdit: (agent: AgentWithHarnessId) => void;
- onDelete: (agent: AgentWithHarnessId) => void;
-}) {
- return (
- <Show
- when={props.rows.length > 0}
- fallback={
- <p class="empty-row">
- {props.loading ? 'Loading agents…' : props.empty}
- </p>
- }
- >
- <For each={props.rows}>
- {(row) => (
- <div class="arow">
- <AgentAvatar
- agent={{
- id: row.id,
- botId: row.id,
- name: row.name,
- avatarUrl: row.avatarUrl,
- }}
- coder={row.kind === 'coder'}
- />
- <div class="info">
- <div class="line">
- <span class="nm truncate">{row.name}</span>
- <span class="tag truncate">@{row.handle}</span>
- <span class={row.share === 'system' ? 'badge system' : 'badge'}>
- {row.share}
- </span>
- </div>
- <p class="sub truncate">
- {row.kind === 'coder' ? `${row.runtime} · ` : ''}
- {row.model} · {row.channels}
- </p>
- </div>
- <div class="acts">
- <Show when={row.agent && row.canEdit}>
- <button
- type="button"
- class="icon-btn"
- aria-label={`Edit ${row.name}`}
- onClick={() => row.agent && props.onEdit(row.agent)}
- >
- <PencilIcon class="ph" />
- </button>
- </Show>
- <Show when={row.agent && row.canDelete}>
- <button
- type="button"
- class="icon-btn neg"
- aria-label={`Delete ${row.name}`}
- onClick={() => row.agent && props.onDelete(row.agent)}
- >
- <TrashIcon class="ph" />
- </button>
- </Show>
- </div>
- </div>
- )}
- </For>
- </Show>
- );
-}
-
-function RuntimeRow(props: {
- icon: JSX.Element;
- name: string;
- badge: 'system' | 'team' | 'private';
- sub: string;
- connected: boolean;
- status: string;
- children: JSX.Element;
-}) {
- return (
- <div class="rt">
- <span class="ic">{props.icon}</span>
- <div style={{ 'min-width': 0 }}>
- <div class="nm">
- <span class="truncate">{props.name}</span>
- <span class={props.badge === 'system' ? 'badge system' : 'badge'}>
- {props.badge}
- </span>
- </div>
- <div class="sub truncate">{props.sub}</div>
- </div>
- <span class={props.connected ? 'conn' : 'conn off'}>{props.status}</span>
- <div class="acts">{props.children}</div>
- </div>
- );
-}
-
-/**
- * "Bring your <agent> to Macro": the name rolls through the supported CLIs,
- * and the slot animates to each word's width so the sentence stays tight.
- */
-function RotatingWord() {
- const [index, setIndex] = createSignal(0);
- const [phase, setPhase] = createSignal<'idle' | 'out' | 'in'>('idle');
- let host: HTMLSpanElement | undefined;
- let measure: HTMLSpanElement | undefined;
-
- onMount(() => {
- const fit = (word: string) => {
- if (!host || !measure) return;
- measure.textContent = word;
- host.style.width = `${measure.offsetWidth}px`;
- };
- fit(BYOA_AGENTS[index()] ?? '');
- void document.fonts?.ready.then(() => fit(BYOA_AGENTS[index()] ?? ''));
- if (
- typeof matchMedia === 'function' &&
- matchMedia('(prefers-reduced-motion: reduce)').matches
- ) {
- return;
- }
- const timer = setInterval(() => {
- if (!host?.offsetParent) return;
- setPhase('out');
- setTimeout(() => {
- const next = (index() + 1) % BYOA_AGENTS.length;
- setIndex(next);
- fit(BYOA_AGENTS[next] ?? '');
- setPhase('in');
- requestAnimationFrame(() => setPhase('idle'));
- }, 380);
- }, 2200);
- onCleanup(() => clearInterval(timer));
- });
-
- return (
- <span class="rot" ref={host} aria-live="off">
- <span class="measure" ref={measure} />
- <span class={phase() === 'idle' ? 'w' : `w ${phase()}`}>
- {BYOA_AGENTS[index()]}
- </span>
- </span>
- );
-}
diff --git a/apps/web/src/features/block-agent/component/sidepanel/AgentSidePanelSections.tsx b/apps/web/src/features/block-agent/component/sidepanel/AgentSidePanelSections.tsx
index 045e3aca21..b0c98eae72 100644
--- a/apps/web/src/features/block-agent/component/sidepanel/AgentSidePanelSections.tsx
+++ b/apps/web/src/features/block-agent/component/sidepanel/AgentSidePanelSections.tsx
@@ -57,7 +57,7 @@ export function AgentSidePanelSections() {
)}
</Show>
<Show when={showsSessionHarness(session() ?? {})}>
- <SidePanel.Row label="Harness">
+ <SidePanel.Row label="Runtime">
<SidePanel.Pill>
<span class="truncate">
{sessionHarnessTitle(session() ?? {})}
diff --git a/apps/web/src/features/claude-connection/components/connection-card.test.tsx b/apps/web/src/features/claude-connection/components/connection-card.test.tsx
index 2bce004fbd..1968c1ee83 100644
--- a/apps/web/src/features/claude-connection/components/connection-card.test.tsx
+++ b/apps/web/src/features/claude-connection/components/connection-card.test.tsx
@@ -4,6 +4,7 @@ import { afterEach, expect, it, vi } from 'vitest';
import { ConnectionCard, type ConnectionCardProps } from './connection-card';
vi.mock('@ui', () => ({
+ confirmDialog: vi.fn(),
Button: (
props: import('solid-js').JSX.ButtonHTMLAttributes<HTMLButtonElement>
) => <button {...props} />,
@@ -23,11 +24,11 @@ function props(): ConnectionCardProps {
onRefresh: vi.fn(),
};
}
-it('shows Claude before connection and explains restart behavior', () => {
+it('shows Claude before connection without adding setup details', () => {
const value = props();
render(() => <ConnectionCard {...value} />);
expect(screen.getByText('Claude Cloud')).toBeTruthy();
- expect(screen.getByText(/Reconnect after a backend restart/)).toBeTruthy();
+ expect(screen.queryByText(/Macro never asks/)).toBeNull();
fireEvent.click(screen.getByRole('button', { name: 'Connect Claude' }));
expect(value.onBegin).toHaveBeenCalledOnce();
});
@@ -42,6 +43,7 @@ it('renders consent link and masked code entry without tokens', () => {
code: 'code#state',
};
render(() => <ConnectionCard {...value} />);
+ expect(screen.getByText(/This connection is temporary/)).toBeTruthy();
expect(screen.getByRole('link').getAttribute('rel')).toBe(
'noopener noreferrer'
);
diff --git a/apps/web/src/features/claude-connection/components/connection-card.tsx b/apps/web/src/features/claude-connection/components/connection-card.tsx
index ea9f19b80b..297170bcb1 100644
--- a/apps/web/src/features/claude-connection/components/connection-card.tsx
+++ b/apps/web/src/features/claude-connection/components/connection-card.tsx
@@ -1,5 +1,5 @@
import AnthropicIcon from '@core/component/AI/assets/anthropic.svg';
-import { Button } from '@ui';
+import { Button, confirmDialog } from '@ui';
import { createUniqueId, Show } from 'solid-js';
import type { ClaudeConnectionStatus, ClaudeLogin } from '../core/connection';
@@ -19,46 +19,53 @@ export type ConnectionCardProps = {
export function ConnectionCard(props: ConnectionCardProps) {
const inputId = createUniqueId();
+ const disconnect = async () => {
+ if (props.busy) return;
+ const confirmed = await confirmDialog({
+ title: 'Disconnect Claude?',
+ body: 'Remove your Claude connection from Macro? Existing cloud sessions keep running. You can reconnect at any time.',
+ confirmLabel: 'Disconnect',
+ tone: 'danger',
+ });
+ if (confirmed && !props.busy) props.onDisconnect();
+ };
return (
<section aria-label="Claude Cloud connection" class="flex gap-4 px-6 py-5">
<div class="flex size-9 shrink-0 items-center justify-center rounded-lg bg-ink/4 text-ink-muted">
<AnthropicIcon class="size-5" aria-label="Anthropic" />
</div>
- <div class="flex min-w-0 flex-1 flex-col gap-3">
- <div class="flex items-center gap-2">
- <h2 class="text-sm font-medium text-ink">Claude Cloud</h2>
- <Show when={props.status?.connected}>
- <span class="text-xs text-success">Connected</span>
- </Show>
+ <div class="min-w-0 flex-1">
+ <div class="flex min-h-5 items-start justify-between gap-3">
+ <h2 class="min-w-0 text-sm/5 font-medium text-ink">Claude Cloud</h2>
+ <span
+ class="inline-flex h-5 shrink-0 items-center whitespace-nowrap rounded-md px-2 text-[11px]/none font-medium"
+ classList={{
+ 'bg-success-bg text-success': !!props.status?.connected,
+ 'bg-ink/5 text-ink-muted': !props.status?.connected,
+ }}
+ >
+ {props.failed
+ ? 'Unavailable'
+ : !props.status
+ ? 'Loading…'
+ : props.status.connected
+ ? 'Connected'
+ : 'Not connected'}
+ </span>
</div>
- <p class="text-sm text-ink-muted">
+ <p class="mt-1 text-sm text-ink-muted">
Run Claude Code in the cloud using your own Claude subscription. No
macrod required.
</p>
- <Show
- when={props.status}
- fallback={
- <p class="text-xs text-ink-muted">
- {props.failed
- ? 'Could not load Claude connection. Check that this workspace’s backend is running.'
- : 'Loading Claude connection…'}
- </p>
- }
- >
+ <div class="mt-3">
<Show
- when={props.status?.enabled}
+ when={!props.status || props.status.enabled}
fallback={
<p class="text-xs text-ink-muted">
Claude sign-in is not configured on this deployment.
</p>
}
>
- <p class="text-xs text-ink-muted">
- {props.status?.ephemeral
- ? 'Credentials stay in server memory. Reconnect after a backend restart.'
- : 'Your connection is saved securely and survives backend restarts.'}{' '}
- Macro never asks for your Claude password.
- </p>
<Show
when={props.login}
keyed
@@ -66,18 +73,22 @@ export function ConnectionCard(props: ConnectionCardProps) {
<div>
<Button
size="sm"
- disabled={props.busy}
+ disabled={props.busy || (!props.status && !props.failed)}
onClick={
- props.status?.connected
- ? props.onDisconnect
- : props.onBegin
+ props.failed
+ ? props.onRefresh
+ : props.status?.connected
+ ? () => void disconnect()
+ : props.onBegin
}
>
- {props.busy
- ? 'Working…'
- : props.status?.connected
- ? 'Disconnect Claude'
- : 'Connect Claude'}
+ {props.failed
+ ? 'Retry connection status'
+ : props.busy
+ ? 'Working…'
+ : props.status?.connected
+ ? 'Disconnect Claude'
+ : 'Connect Claude'}
</Button>
</div>
}
@@ -90,6 +101,12 @@ export function ConnectionCard(props: ConnectionCardProps) {
props.onComplete();
}}
>
+ <p class="text-xs text-ink-muted">
+ {props.status?.ephemeral
+ ? 'This connection is temporary. You may need to reconnect later.'
+ : 'Your connection is saved securely.'}{' '}
+ Macro never asks for your Claude password.
+ </p>
<a
class="text-sm text-accent underline"
href={login.authorizationUrl}
@@ -139,24 +156,17 @@ export function ConnectionCard(props: ConnectionCardProps) {
)}
</Show>
</Show>
- </Show>
- <Show when={props.status?.connected}>
- <p class="text-xs text-ink-muted">
- Ready. In Settings → Agents, choose Claude Cloud as the agent’s
- harness. Disconnecting forgets Macro’s grant; it does not revoke
- consent at Claude or stop an already-running cloud turn.
- </p>
- </Show>
+ </div>
<Show when={props.error}>
- <p role="alert" class="text-sm text-failure">
+ <p role="alert" class="mt-3 text-sm text-failure">
{props.error}
</p>
</Show>
<Show when={props.failed}>
<div>
- <Button size="sm" onClick={props.onRefresh}>
- Retry connection status
- </Button>
+ <p role="alert" class="mt-3 text-xs text-ink-muted">
+ Could not load Claude connection. Try again.
+ </p>
</div>
</Show>
</div>
diff --git a/apps/web/src/features/settings/AgentSettings.tsx b/apps/web/src/features/settings/AgentSettings.tsx
new file mode 100644
index 0000000000..83feaa4b56
--- /dev/null
+++ b/apps/web/src/features/settings/AgentSettings.tsx
@@ -0,0 +1,52 @@
+import { useSearchParams } from '@solidjs/router';
+import { createSignal, Show } from 'solid-js';
+import { Agents } from './Agents';
+import {
+ AgentManagementNavigation,
+ type AgentManagementSection,
+} from './components/agent-management-navigation';
+import { BringYourOwnAgent } from './components/bring-your-own-agent';
+import { Harness } from './Harness';
+
+/** One management surface, mounted by both Settings and the Agents workspace. */
+export function AgentSettings(props: {
+ initialSection?: AgentManagementSection;
+}) {
+ const [searchParams] = useSearchParams();
+ const [section, setSection] = createSignal<AgentManagementSection>(
+ searchParams.pair ? 'runtimes' : (props.initialSection ?? 'agents')
+ );
+ const [startPairing, setStartPairing] = createSignal(false);
+ const navigation = () => (
+ <AgentManagementNavigation
+ section={section()}
+ onChange={(section) => {
+ setStartPairing(false);
+ setSection(section);
+ }}
+ />
+ );
+
+ return (
+ <Show
+ when={section() === 'agents'}
+ fallback={
+ <Harness navigation={navigation()} startPairing={startPairing()} />
+ }
+ >
+ <Agents
+ navigation={
+ <>
+ <BringYourOwnAgent
+ onAddRuntime={() => {
+ setStartPairing(true);
+ setSection('runtimes');
+ }}
+ />
+ {navigation()}
+ </>
+ }
+ />
+ </Show>
+ );
+}
diff --git a/apps/web/src/features/settings/Agents.test.tsx b/apps/web/src/features/settings/Agents.test.tsx
index e0f972caf4..8fd205a6b5 100644
--- a/apps/web/src/features/settings/Agents.test.tsx
+++ b/apps/web/src/features/settings/Agents.test.tsx
@@ -23,6 +23,23 @@ import { Suspense } from 'solid-js';
import { createStore } from 'solid-js/store';
import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { Agents } from './Agents';
+import { chooseSelectOption, selectOptions } from './tests/select-helpers';
+
+// The real Lexical surface has its own Markdown round-trip suite.
+vi.mock('./components/instructions-editor', () => ({
+ AgentInstructionsEditor: (props: {
+ markdown: string;
+ disabled?: boolean;
+ onChange: (markdown: string) => void;
+ }) => (
+ <textarea
+ aria-label="Instructions"
+ disabled={props.disabled}
+ value={props.markdown}
+ onInput={(event) => props.onChange(event.currentTarget.value)}
+ />
+ ),
+}));
const claudeFlag = vi.hoisted(() => ({ enabled: true }));
vi.mock('@app/lib/analytics/posthog', () => ({
@@ -253,6 +270,7 @@ vi.mock('@queries/pipedream-connectors', () => ({
};
},
isFetching: false,
+ isSuccess: true,
isFetchingNextPage: false,
hasNextPage: false,
isError: false,
@@ -322,8 +340,10 @@ describe('Agents', () => {
]);
try {
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
- const option = screen.queryByRole('option', {
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
+ const option = selectOptions(
+ screen.getByLabelText('Runtime')
+ ).queryByRole('option', {
name: 'Claude Cloud',
});
expect(Boolean(option)).toBe(enabled);
@@ -340,7 +360,7 @@ describe('Agents', () => {
it('opens the new-agent form from a link and clears the action on cancel', () => {
updateSearchParams({ createAgent: 'true' });
render(() => <Agents />);
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
expect(
within(dialog).getByRole('button', { name: 'Create agent' })
).toBeTruthy();
@@ -385,18 +405,12 @@ describe('Agents', () => {
</Suspense>
</QueryClientProvider>
));
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
- fireEvent.change(screen.getByRole('combobox', { name: 'Harness' }), {
- target: { value: 'cursor' },
- });
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
+ chooseSelectOption(screen.getByLabelText('Runtime'), 'Cursor');
expect(screen.queryByText('Settings suspended')).toBeNull();
expect(screen.getByText('Loading models…')).toBeTruthy();
expect(
- (
- screen.getByRole('combobox', {
- name: 'Default model',
- }) as HTMLSelectElement
- ).disabled
+ (screen.getByLabelText('Default model') as HTMLButtonElement).disabled
).toBe(true);
if (outcome === 'error') {
@@ -423,17 +437,11 @@ describe('Agents', () => {
],
});
await waitFor(() =>
- expect(
- screen.getByRole('option', { name: 'Loaded Model' })
- ).toBeTruthy()
+ expect(screen.getByText('Loaded Model')).toBeTruthy()
);
expect(screen.queryByText('Settings suspended')).toBeNull();
expect(
- (
- screen.getByRole('combobox', {
- name: 'Default model',
- }) as HTMLSelectElement
- ).disabled
+ (screen.getByLabelText('Default model') as HTMLButtonElement).disabled
).toBe(false);
}
view.unmount();
@@ -488,25 +496,29 @@ describe('Agents', () => {
));
try {
fireEvent.click(screen.getByRole('button', { name: 'Edit Bug fixer' }));
- const harness = screen.getByRole('combobox', { name: 'Harness' });
- expect(harness).toHaveProperty('value', 'claude-cloud');
+ const harness = screen.getByLabelText('Runtime');
+ expect(harness).toHaveProperty('textContent', 'Claude Cloud');
expect(screen.getByText('Loading models…')).toBeTruthy();
resolveModels({
status: 'available',
currentModel: 'claude-fable-5-1',
models: [{ id: 'claude-fable-5-1', name: 'Fable 5.1' }],
});
+ await waitFor(() => expect(screen.getByText('Fable 5.1')).toBeTruthy());
+ expect(harness).toHaveProperty('textContent', 'Claude Cloud');
+ chooseSelectOption(harness, 'Macro Agent');
await waitFor(() =>
- expect(screen.getByRole('option', { name: 'Fable 5.1' })).toBeTruthy()
- );
- expect(harness).toHaveProperty('value', 'claude-cloud');
- fireEvent.change(harness, { target: { value: 'in-memory' } });
- await waitFor(() =>
- expect(
- screen.getByRole('combobox', { name: 'Default model' })
- ).toHaveProperty('value', Model.sonnet5)
+ expect(screen.getByLabelText('Default model')).toHaveProperty(
+ 'textContent',
+ 'Claude Sonnet 4.5'
+ )
);
- expect(screen.queryByRole('option', { name: /Fable/i })).toBeNull();
+ expect(
+ selectOptions(screen.getByLabelText('Default model')).queryByRole(
+ 'option',
+ { name: /Fable/i }
+ )
+ ).toBeNull();
fireEvent.click(screen.getByRole('button', { name: 'Save changes' }));
await waitFor(() =>
expect(agentMocks.update).toHaveBeenCalledWith(
@@ -690,8 +702,8 @@ describe('Agents', () => {
render(() => <Agents />);
fireEvent.click(screen.getByRole('button', { name: 'Edit Bug fixer' }));
- const dialog = screen.getByRole('dialog');
- expect(within(dialog).getByText('Edit agent')).toBeTruthy();
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
+ expect(screen.getByRole('heading', { name: 'Edit agent' })).toBeTruthy();
expect(within(dialog).getByLabelText('Name')).toHaveProperty(
'value',
'Bug fixer'
@@ -764,7 +776,7 @@ describe('Agents', () => {
).toBeNull();
fireEvent.click(screen.getByRole('button', { name: 'Edit Bug fixer' }));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
expect(within(dialog).getByLabelText('Team')).toHaveProperty(
'checked',
true
@@ -804,7 +816,9 @@ describe('Agents', () => {
const view = render(() => <Agents />);
fireEvent.click(screen.getByRole('button', { name: 'Edit Bug fixer' }));
expect(
- within(screen.getByRole('dialog')).getByLabelText('Private')
+ within(
+ screen.getByRole('region', { name: /^(New|Edit) agent$/ })
+ ).getByLabelText('Private')
).toHaveProperty('disabled', false);
view.unmount();
@@ -861,10 +875,10 @@ describe('Agents', () => {
it('offers agent configuration without description and only connected harnesses', () => {
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
- const dialog = screen.getByRole('dialog');
- const harness = within(dialog).getByLabelText('Harness');
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
+ const harness = within(dialog).getByLabelText('Runtime');
expect(
within(dialog).getByRole('button', { name: 'Upload avatar' })
@@ -886,9 +900,9 @@ describe('Agents', () => {
expect(within(dialog).getByLabelText('Name')).toBeTruthy();
expect(within(dialog).getByLabelText('@tag')).toBeTruthy();
expect(within(dialog).queryByLabelText('Description')).toBeNull();
- expect(within(dialog).getByLabelText('System prompt')).toBeTruthy();
- expect(harness).toHaveProperty('value', 'in-memory');
- expect(within(harness).getAllByRole('option')).toHaveLength(1);
+ expect(within(dialog).getByLabelText('Instructions')).toBeTruthy();
+ expect(harness).toHaveProperty('textContent', 'Macro Agent');
+ expect(selectOptions(harness).getAllByRole('option')).toHaveLength(1);
expect(within(dialog).getByLabelText('Default model')).toBeTruthy();
expect(
within(dialog).getByRole('group', { name: 'Channels' })
@@ -906,9 +920,9 @@ describe('Agents', () => {
agentMocks.currentTeam = null;
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
const teamOption = within(dialog).getByLabelText('Team');
expect(teamOption).toHaveProperty('disabled', true);
const teamCardClasses = teamOption.closest('label')?.classList;
@@ -923,14 +937,14 @@ describe('Agents', () => {
it('persists creation through the agents API', async () => {
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
fireEvent.input(within(dialog).getByLabelText('Name'), {
target: { value: 'Bug fixer' },
});
- fireEvent.input(within(dialog).getByLabelText('System prompt'), {
- target: { value: 'Fix the root cause and add tests.' },
+ fireEvent.input(within(dialog).getByLabelText('Instructions'), {
+ target: { value: 'Fix the **root cause** and add tests.' },
});
fireEvent.click(within(dialog).getByLabelText('Team'));
fireEvent.click(
@@ -947,7 +961,7 @@ describe('Agents', () => {
handle: 'bug-fixer',
harness: 'in-memory',
name: 'Bug fixer',
- instructions: 'Fix the root cause and add tests.',
+ instructions: 'Fix the **root cause** and add tests.',
mcp: { scope: 'owner_connections' },
teamId: 'team-1',
});
@@ -956,7 +970,7 @@ describe('Agents', () => {
});
});
- it('offers Cursor and its models when Cursor is connected', () => {
+ it('offers Cursor and saves the model chosen from its dropdown', async () => {
cursorMocks.status.data = {
registered: true,
updatedAt: '2026-08-27T12:00:00Z',
@@ -967,33 +981,51 @@ describe('Agents', () => {
]);
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
- const dialog = screen.getByRole('dialog');
- const harness = within(dialog).getByLabelText('Harness');
- expect(within(harness).getAllByRole('option')).toHaveLength(2);
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
+ const harness = within(dialog).getByLabelText('Runtime');
+ expect(selectOptions(harness).getAllByRole('option')).toHaveLength(2);
- fireEvent.change(harness, { target: { value: 'cursor' } });
- expect(harness).toHaveProperty('value', 'cursor');
+ chooseSelectOption(harness, 'Cursor');
+ expect(harness).toHaveProperty('textContent', 'Cursor');
const defaultModel = within(dialog).getByLabelText('Default model');
- expect(within(defaultModel).getAllByRole('option')).toHaveLength(2);
+ expect(selectOptions(defaultModel).getAllByRole('option')).toHaveLength(2);
expect(
- within(defaultModel).getByRole('option', { name: 'Cursor Small' })
- ).toHaveProperty('selected', true);
+ selectOptions(defaultModel)
+ .getByRole('option', { name: 'Cursor Small' })
+ .getAttribute('aria-selected')
+ ).toBe('true');
+ chooseSelectOption(defaultModel, 'Cursor Large');
+ expect(defaultModel.textContent).toBe('Cursor Large');
+ fireEvent.input(within(dialog).getByLabelText('Name'), {
+ target: { value: 'Coding agent' },
+ });
+ fireEvent.click(
+ within(dialog).getByRole('button', { name: 'Create agent' })
+ );
+ await waitFor(() =>
+ expect(agentMocks.create).toHaveBeenCalledWith(
+ expect.objectContaining({
+ harness: 'cursor',
+ defaultModel: 'cursor-large',
+ })
+ )
+ );
});
it('offers registered macrod harnesses in the harness picker', () => {
harnessMocks.query.data = [MACROD_HARNESS];
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
- const dialog = screen.getByRole('dialog');
- const harness = within(dialog).getByLabelText('Harness');
- expect(within(harness).getAllByRole('option')).toHaveLength(2);
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
+ const harness = within(dialog).getByLabelText('Runtime');
+ expect(selectOptions(harness).getAllByRole('option')).toHaveLength(2);
expect(
- within(harness).getByRole('option', { name: 'Dev box' })
+ selectOptions(harness).getByRole('option', { name: 'Dev box' })
).toBeTruthy();
});
@@ -1023,25 +1055,24 @@ describe('Agents', () => {
</QueryClientProvider>
));
await waitFor(() => expect(fetchHarnesses).toHaveBeenCalledOnce());
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
- const dialog = screen.getByRole('dialog');
- const harness = within(dialog).getByRole('combobox', { name: 'Harness' });
- await waitFor(() =>
- expect(
- within(harness).getByRole('option', { name: 'Dev box' })
- ).toBeTruthy()
- );
- fireEvent.change(harness, { target: { value: MACROD_HARNESS.id } });
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
+ const harness = within(dialog).getByLabelText('Runtime');
+ expect(
+ selectOptions(harness).getByRole('option', { name: 'Dev box' })
+ ).toBeTruthy();
+ chooseSelectOption(harness, 'Dev box');
fireEvent.input(within(dialog).getByLabelText('Name'), {
target: { value: 'Coding agent' },
});
for (let refresh = 0; refresh < 2; refresh++) {
await client.refetchQueries({ queryKey });
- expect(harness).toHaveProperty('value', MACROD_HARNESS.id);
- expect(
- within(dialog).getByRole('combobox', { name: 'Default model' })
- ).toHaveProperty('value', 'codex-model');
+ expect(harness).toHaveProperty('textContent', 'Dev box');
+ expect(within(dialog).getByLabelText('Default model')).toHaveProperty(
+ 'textContent',
+ 'Codex model'
+ );
}
expect(fetchHarnesses).toHaveBeenCalledTimes(3);
fireEvent.click(
@@ -1093,15 +1124,13 @@ describe('Agents', () => {
};
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
- const dialog = screen.getByRole('dialog');
- const harness = within(dialog).getByLabelText('Harness');
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
+ const harness = within(dialog).getByLabelText('Runtime');
- expect(
- within(dialog).getByRole('option', { name: 'Claude Sonnet 4.5' })
- ).toBeTruthy();
+ expect(within(dialog).getByText('Claude Sonnet 4.5')).toBeTruthy();
- fireEvent.change(harness, { target: { value: 'cursor' } });
+ chooseSelectOption(harness, 'Cursor');
expect(
within(dialog).getByText(/Could not load models for Cursor/)
).toBeTruthy();
@@ -1110,14 +1139,14 @@ describe('Agents', () => {
);
expect(retry).toHaveBeenCalledOnce();
- fireEvent.change(harness, { target: { value: MACROD_HARNESS.id } });
+ chooseSelectOption(harness, 'Dev box');
expect(
within(dialog).getByText(
- 'Model selection is unsupported by this harness.'
+ 'Model selection is unsupported by this runtime.'
)
).toBeTruthy();
- fireEvent.change(harness, { target: { value: loadingHarness.id } });
+ chooseSelectOption(harness, 'Loading box');
expect(within(dialog).getByText('Loading models…')).toBeTruthy();
});
@@ -1132,16 +1161,16 @@ describe('Agents', () => {
);
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
- const dialog = screen.getByRole('dialog');
- const harness = within(dialog).getByLabelText('Harness');
- fireEvent.change(harness, { target: { value: MACROD_HARNESS.id } });
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
+ const harness = within(dialog).getByLabelText('Runtime');
+ chooseSelectOption(harness, 'Dev box');
const defaultModel = within(dialog).getByLabelText('Default model');
- expect(defaultModel.tagName).toBe('SELECT');
- expect(defaultModel).toHaveProperty('value', 'codex');
- expect(within(defaultModel).getAllByRole('option')).toHaveLength(2);
+ expect(defaultModel.tagName).toBe('BUTTON');
+ expect(defaultModel).toHaveProperty('textContent', 'Codex');
+ expect(selectOptions(defaultModel).getAllByRole('option')).toHaveLength(2);
});
it('falls back to the first advertised model when current is absent', () => {
@@ -1155,15 +1184,13 @@ describe('Agents', () => {
);
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
- const dialog = screen.getByRole('dialog');
- fireEvent.change(within(dialog).getByLabelText('Harness'), {
- target: { value: MACROD_HARNESS.id },
- });
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
+ chooseSelectOption(within(dialog).getByLabelText('Runtime'), 'Dev box');
expect(within(dialog).getByLabelText('Default model')).toHaveProperty(
- 'value',
- 'claude-code'
+ 'textContent',
+ 'Claude Code'
);
});
@@ -1175,16 +1202,17 @@ describe('Agents', () => {
);
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
- const dialog = screen.getByRole('dialog');
- fireEvent.change(within(dialog).getByLabelText('Harness'), {
- target: { value: MACROD_HARNESS.id },
- });
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
+ chooseSelectOption(within(dialog).getByLabelText('Runtime'), 'Dev box');
const defaultModel = within(dialog).getByLabelText('Default model');
- expect(defaultModel).toHaveProperty('value', 'provider-default');
+ expect(defaultModel).toHaveProperty(
+ 'textContent',
+ 'provider-default (unavailable)'
+ );
expect(
- within(defaultModel).getByRole('option', {
+ selectOptions(defaultModel).getByRole('option', {
name: 'provider-default (unavailable)',
})
).toBeTruthy();
@@ -1198,15 +1226,13 @@ describe('Agents', () => {
);
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
fireEvent.input(within(dialog).getByLabelText('Name'), {
target: { value: 'Bug fixer' },
});
- fireEvent.change(within(dialog).getByLabelText('Harness'), {
- target: { value: MACROD_HARNESS.id },
- });
+ chooseSelectOption(within(dialog).getByLabelText('Runtime'), 'Dev box');
fireEvent.click(
within(dialog).getByRole('button', { name: 'Create agent' })
);
@@ -1253,12 +1279,15 @@ describe('Agents', () => {
render(() => <Agents />);
fireEvent.click(screen.getByRole('button', { name: 'Edit Bug fixer' }));
- const defaultModel = within(screen.getByRole('dialog')).getByLabelText(
- 'Default model'
+ const defaultModel = within(
+ screen.getByRole('region', { name: /^(New|Edit) agent$/ })
+ ).getByLabelText('Default model');
+ expect(defaultModel).toHaveProperty(
+ 'textContent',
+ 'retired-model (saved, unavailable)'
);
- expect(defaultModel).toHaveProperty('value', 'retired-model');
expect(
- within(defaultModel).getByRole('option', {
+ selectOptions(defaultModel).getByRole('option', {
name: 'retired-model (saved, unavailable)',
})
).toBeTruthy();
@@ -1294,10 +1323,10 @@ describe('Agents', () => {
render(() => <Agents />);
fireEvent.click(screen.getByRole('button', { name: 'Edit Bug fixer' }));
- const dialog = screen.getByRole('dialog');
- expect(within(dialog).getByLabelText('Harness')).toHaveProperty(
- 'value',
- 'claude-cloud'
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
+ expect(within(dialog).getByLabelText('Runtime')).toHaveProperty(
+ 'textContent',
+ 'Claude Cloud'
);
fireEvent.click(
within(dialog).getByRole('button', { name: 'Save changes' })
@@ -1342,14 +1371,14 @@ describe('Agents', () => {
render(() => <Agents />);
fireEvent.click(screen.getByRole('button', { name: 'Edit Bug fixer' }));
- const dialog = screen.getByRole('dialog');
- expect(within(dialog).getByLabelText('Harness')).toHaveProperty(
- 'value',
- MACROD_HARNESS.id
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
+ expect(within(dialog).getByLabelText('Runtime')).toHaveProperty(
+ 'textContent',
+ 'Dev box'
);
const defaultModel = within(dialog).getByLabelText('Default model');
- expect(defaultModel.tagName).toBe('SELECT');
- expect(defaultModel).toHaveProperty('value', 'default');
+ expect(defaultModel.tagName).toBe('BUTTON');
+ expect(defaultModel).toHaveProperty('textContent', 'Harness default');
});
const linearAgent = {
@@ -1384,7 +1413,7 @@ describe('Agents', () => {
render(() => <Agents />);
fireEvent.click(screen.getByRole('button', { name: 'Edit Triage bot' }));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
expect(within(dialog).queryByText('Connections')).toBeNull();
fireEvent.click(
within(dialog).getByRole('button', { name: 'Save changes' })
@@ -1401,9 +1430,9 @@ describe('Agents', () => {
it('defaults new agents to the owner connections policy', () => {
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
expect(
within(dialog).getByLabelText('Use my connected apps')
).toHaveProperty('checked', true);
@@ -1412,9 +1441,9 @@ describe('Agents', () => {
it('picks apps from the whole catalog, shows the viewer connection state, and persists them', async () => {
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
fireEvent.input(within(dialog).getByLabelText('Name'), {
target: { value: 'Triage bot' },
});
@@ -1425,15 +1454,14 @@ describe('Agents', () => {
within(dialog).getByRole('button', { name: 'Create agent' })
).toHaveProperty('disabled', true);
+ within(dialog).getByLabelText('Search connectors').focus();
fireEvent.input(within(dialog).getByLabelText('Search connectors'), {
target: { value: 'lin' },
});
await waitFor(() => {
- expect(
- within(dialog).getByRole('option', { name: /Linear/ })
- ).toBeTruthy();
+ expect(screen.getByRole('option', { name: /Linear/ })).toBeTruthy();
});
- fireEvent.click(within(dialog).getByRole('option', { name: /Linear/ }));
+ fireEvent.click(screen.getByRole('option', { name: /Linear/ }));
// The pick is listed as not connected for this viewer, with a way in.
await waitFor(() => {
@@ -1448,9 +1476,7 @@ describe('Agents', () => {
target: { value: 'lin' },
});
await waitFor(() => {
- expect(
- within(dialog).queryByRole('option', { name: /Linear/ })
- ).toBeNull();
+ expect(screen.queryByRole('option', { name: /Linear/ })).toBeNull();
});
// Unconnected picks never block saving: the agent's author chooses the
@@ -1476,7 +1502,7 @@ describe('Agents', () => {
render(() => <Agents />);
fireEvent.click(screen.getByRole('button', { name: 'Edit Triage bot' }));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
expect(within(dialog).getByLabelText('Specific apps')).toHaveProperty(
'checked',
true
@@ -1525,11 +1551,9 @@ it('requires prompts unless the harness operator permits bypass', async () => {
{ id: 'claude-code', name: 'Claude Code' },
]);
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
- const dialog = screen.getByRole('dialog');
- fireEvent.change(within(dialog).getByLabelText('Harness'), {
- target: { value: MACROD_HARNESS.id },
- });
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
+ chooseSelectOption(within(dialog).getByLabelText('Runtime'), 'Dev box');
expect(within(dialog).getByLabelText('Always prompt')).toHaveProperty(
'checked',
true
@@ -1546,11 +1570,9 @@ it('offers bypass only after harness consent and resets the choice on harness ch
{ id: 'claude-code', name: 'Claude Code' },
]);
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
- const dialog = screen.getByRole('dialog');
- fireEvent.change(within(dialog).getByLabelText('Harness'), {
- target: { value: MACROD_HARNESS.id },
- });
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
+ chooseSelectOption(within(dialog).getByLabelText('Runtime'), 'Dev box');
expect(within(dialog).getByLabelText('Always prompt')).toHaveProperty(
'checked',
true
@@ -1560,9 +1582,7 @@ it('offers bypass only after harness consent and resets the choice on harness ch
'checked',
true
);
- fireEvent.change(within(dialog).getByLabelText('Harness'), {
- target: { value: 'prompt-only' },
- });
+ chooseSelectOption(within(dialog).getByLabelText('Runtime'), 'Prompt only');
expect(within(dialog).getByLabelText('Always prompt')).toHaveProperty(
'checked',
true
@@ -1579,14 +1599,19 @@ it.each(['in-memory', 'cursor', 'claude-cloud'])(
]);
agentMocks.create.mockClear();
render(() => <Agents />);
- fireEvent.click(screen.getByRole('button', { name: 'Create agent' }));
- const dialog = screen.getByRole('dialog');
+ fireEvent.click(screen.getByRole('button', { name: 'New agent' }));
+ const dialog = screen.getByRole('region', { name: /^(New|Edit) agent$/ });
fireEvent.input(within(dialog).getByLabelText('Name'), {
target: { value: 'Built-in agent' },
});
- fireEvent.change(within(dialog).getByLabelText('Harness'), {
- target: { value: harness },
- });
+ chooseSelectOption(
+ within(dialog).getByLabelText('Runtime'),
+ {
+ 'in-memory': 'Macro Agent',
+ cursor: 'Cursor',
+ 'claude-cloud': 'Claude Cloud',
+ }[harness]!
+ );
expect(within(dialog).queryByText('Permission requests')).toBeNull();
expect(within(dialog).queryByLabelText('Always prompt')).toBeNull();
expect(within(dialog).queryByLabelText('Always bypass')).toBeNull();
diff --git a/apps/web/src/features/settings/Agents.tsx b/apps/web/src/features/settings/Agents.tsx
index c6933ff798..2c57361b9b 100644
--- a/apps/web/src/features/settings/Agents.tsx
+++ b/apps/web/src/features/settings/Agents.tsx
@@ -12,12 +12,12 @@ import { useChannelsContext } from '@core/context/channels';
import { useUserId } from '@core/context/user';
import { usePipedreamMcpFlag } from '@core/pipedream/flag';
import MacroLogo from '@icon/macro-logo.svg';
+import ArrowLeftIcon from '@phosphor/arrow-left.svg';
import PencilIcon from '@phosphor/pencil-simple.svg';
import PlusIcon from '@phosphor/plus.svg';
import AgentIcon from '@phosphor/sparkle.svg';
import TrashIcon from '@phosphor/trash.svg';
import UploadIcon from '@phosphor/upload-simple.svg';
-import XIcon from '@phosphor/x.svg';
import {
type AgentWithHarnessId,
type CreateAgentParams,
@@ -39,10 +39,13 @@ import type { AgentMcpServer } from '@service-storage/generated/schemas/agentMcp
import type { AgentMcpServers } from '@service-storage/generated/schemas/agentMcpServers';
import { useSearchParams } from '@solidjs/router';
import { Avatar, Button, Dialog, Panel } from '@ui';
-import { createMemo, createSignal, For, Show } from 'solid-js';
+import { createMemo, createSignal, For, type JSX, Show } from 'solid-js';
import { botAssignableChannelOptions } from '../channel/Bots/botChannelOptions';
import { canDeleteBot, canManageAgent } from '../channel/Bots/botPermissions';
import { ChannelMultiSelect } from '../channel/Bots/ChannelMultiSelect';
+import { AgentSettingsDescription } from './components/agent-settings-description';
+import { AgentInstructionsEditor } from './components/instructions-editor';
+import { SettingsSelect } from './components/settings-select';
import { PipedreamAppPicker } from './PipedreamAppPicker';
import {
ChoiceRow,
@@ -99,7 +102,7 @@ const MACRO_AGENT: AgentSummary = {
};
/** Settings page for viewing and creating persistent agents. */
-export function Agents() {
+export function Agents(props: { navigation?: JSX.Element } = {}) {
const claudeCloudFlag = useFeatureFlag(claudeCloud);
const [creating, setCreating] = createSignal(false);
const [searchParams, setSearchParams] = useSearchParams();
@@ -245,59 +248,24 @@ export function Agents() {
return (
<>
- <SettingsPage
- title="Agents"
- description="Create agents with their own identity, instructions, and runtime."
- actions={
- <Button variant="cta" size="sm" onClick={() => setCreating(true)}>
- <PlusIcon />
- Create agent
- </Button>
- }
- >
- <SettingsSection
- title="Team agents"
- description="Agents shared with your team, including Macro."
- >
- <SettingsCard>
- <For each={teamAgents()}>
- {(agent) => (
- <AgentRow
- agent={agent}
- onEdit={
- agent.editable && agent.persistedAgent
- ? () => setEditingAgent(agent.persistedAgent)
- : undefined
- }
- onDelete={
- agent.persistedAgent && canDeleteAgent(agent.persistedAgent)
- ? () => setDeletingAgent(agent.persistedAgent)
- : undefined
- }
- />
- )}
- </For>
- </SettingsCard>
- </SettingsSection>
-
- <SettingsSection
- title="Private agents"
- description="Agents owned by you rather than your team."
+ <Show when={!creating() && !creatingFromLink() && !editingAgent()}>
+ <SettingsPage
+ title="Agents"
+ description={<AgentSettingsDescription />}
+ actions={
+ <Button variant="cta" size="sm" onClick={() => setCreating(true)}>
+ <PlusIcon />
+ New agent
+ </Button>
+ }
>
- <SettingsCard>
- <Show
- when={privateAgents().length > 0}
- fallback={
- <p class="px-6 py-4 text-sm text-ink-muted">
- {agentsQuery.isPending
- ? 'Loading agents…'
- : agentsQuery.isError
- ? 'Your agents are unavailable.'
- : 'No private agents yet.'}
- </p>
- }
- >
- <For each={privateAgents()}>
+ {props.navigation}
+ <SettingsSection
+ title="Team agents"
+ description="Agents shared with your team, including Macro."
+ >
+ <SettingsCard>
+ <For each={teamAgents()}>
{(agent) => (
<AgentRow
agent={agent}
@@ -315,18 +283,57 @@ export function Agents() {
/>
)}
</For>
- </Show>
- <Show when={agentsQuery.isError}>
- <p class="px-6 py-4 text-xs text-negative">
- Could not load your agents. Try refreshing this page.
- </p>
- </Show>
- </SettingsCard>
- </SettingsSection>
- </SettingsPage>
+ </SettingsCard>
+ </SettingsSection>
+
+ <SettingsSection
+ title="Private agents"
+ description="Agents owned by you rather than your team."
+ >
+ <SettingsCard>
+ <Show
+ when={privateAgents().length > 0}
+ fallback={
+ <p class="px-6 py-4 text-sm text-ink-muted">
+ {agentsQuery.isPending
+ ? 'Loading agents…'
+ : agentsQuery.isError
+ ? 'Your agents are unavailable.'
+ : 'No private agents yet.'}
+ </p>
+ }
+ >
+ <For each={privateAgents()}>
+ {(agent) => (
+ <AgentRow
+ agent={agent}
+ onEdit={
+ agent.editable && agent.persistedAgent
+ ? () => setEditingAgent(agent.persistedAgent)
+ : undefined
+ }
+ onDelete={
+ agent.persistedAgent &&
+ canDeleteAgent(agent.persistedAgent)
+ ? () => setDeletingAgent(agent.persistedAgent)
+ : undefined
+ }
+ />
+ )}
+ </For>
+ </Show>
+ <Show when={agentsQuery.isError}>
+ <p class="px-6 py-4 text-xs text-negative">
+ Could not load your agents. Try refreshing this page.
+ </p>
+ </Show>
+ </SettingsCard>
+ </SettingsSection>
+ </SettingsPage>
+ </Show>
<Show when={creating() || creatingFromLink()}>
- <AgentDialog
+ <AgentEditorPage
connectedHarnesses={connectedHarnesses()}
currentTeamId={currentTeamId()}
canShareWithTeam={canShareWithTeam()}
@@ -338,7 +345,7 @@ export function Agents() {
</Show>
<Show when={editingAgent()} keyed>
{(agent) => (
- <AgentDialog
+ <AgentEditorPage
agent={agent}
connectedHarnesses={connectedHarnesses()}
currentTeamId={currentTeamId()}
@@ -403,7 +410,7 @@ function harnessName(id: string): string {
if (id === 'claude-cloud') return 'Claude Cloud';
// Any other id is a registered macrod harness uuid; if it is not in the
// connected list any more, the harness has been removed.
- return 'Disconnected harness';
+ return 'Disconnected runtime';
}
function AgentRow(props: {
@@ -540,7 +547,7 @@ function AgentDeleteDialog(props: {
);
}
-function AgentDialog(props: {
+function AgentEditorPage(props: {
agent?: AgentWithHarnessId;
connectedHarnesses: readonly ConnectedHarness[];
currentTeamId?: string;
@@ -556,7 +563,7 @@ function AgentDialog(props: {
const [avatarUrl, setAvatarUrl] = createSignal<string | undefined>(
props.agent?.bot.avatar_url ?? undefined
);
- const [instructions, setSystemPrompt] = createSignal(
+ const [instructions, setInstructions] = createSignal(
props.agent?.instructions ?? ''
);
const [harnessId, setHarnessId] = createSignal(
@@ -676,9 +683,11 @@ function AgentDialog(props: {
selectedHarness()?.kind === 'builtin' ||
(allowPermissionBypass() && autoAcceptChoice());
let avatarInputRef: HTMLInputElement | undefined;
- let dialogContentRef: HTMLDivElement | undefined;
+ let pageContentRef: HTMLDivElement | undefined;
- const close = () => props.onClose();
+ const close = () => {
+ if (!props.pending) props.onClose();
+ };
const handleNameInput = (value: string) => {
setName(value);
@@ -744,432 +753,402 @@ function AgentDialog(props: {
};
return (
- <Dialog
- open
- onOpenChange={(open) => !open && close()}
- position="center"
- visibleScrim
- class="w-[min(720px,calc(100vw-16px))]"
- contentRef={(element) => {
- dialogContentRef = element;
- }}
+ <SettingsPage
+ title={props.agent ? 'Edit agent' : 'New agent'}
+ showTitleInSheet
+ description="Give your agent an identity, instructions, and a runtime."
+ actions={
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={close}
+ disabled={props.pending}
+ >
+ <ArrowLeftIcon /> Back
+ </Button>
+ }
>
- <Panel depth={2} class="max-h-[88vh] rounded-xl text-ink">
- <Panel.Header class="justify-between px-3">
- <Dialog.Title as="span" class="m-0 p-0 text-sm font-medium">
- {props.agent ? 'Edit agent' : 'Create agent'}
- </Dialog.Title>
- <Dialog.CloseButton as={Button} variant="ghost" size="icon-sm">
- <XIcon />
- </Dialog.CloseButton>
- </Panel.Header>
-
- <Panel.Body class="overflow-y-auto p-5">
- <form
- id="agent-form"
- class="flex flex-col gap-6"
- onSubmit={(event) => {
- event.preventDefault();
- void submit();
- }}
+ <section
+ aria-label={props.agent ? 'Edit agent' : 'New agent'}
+ class="@container"
+ ref={pageContentRef}
+ >
+ <form
+ id="agent-form"
+ class="flex flex-col gap-6"
+ onSubmit={(event) => {
+ event.preventDefault();
+ void submit();
+ }}
+ >
+ <AgentFormSection
+ title="Profile"
+ description="How this agent appears in channels and mentions."
>
- <AgentFormSection
- title="Profile"
- description="How this agent appears in channels and mentions."
- >
- <div class="flex items-center gap-3 border-b border-edge-muted pb-4">
- <button
- type="button"
- aria-label="Upload avatar"
- class="rounded-full outline-none focus-visible:ring-2 focus-visible:ring-accent"
- onClick={() => avatarInputRef?.click()}
- >
- <AgentAvatar
- agent={{
- id: 'draft',
- name: name() || 'Agent',
- tag: tag(),
- avatarUrl: avatarUrl(),
- instructions: '',
- harness: '',
- defaultModel: '',
- channelSummary: '',
- share: share(),
- }}
- />
- </button>
- <div class="min-w-0 flex-1">
- <div class="text-sm font-medium text-ink">Avatar</div>
- <div class="mt-0.5 text-xs text-ink-muted">
- Optional · square images work best
- </div>
- </div>
- <input
- ref={avatarInputRef}
- type="file"
- accept="image/*"
- class="hidden"
- onChange={(event) =>
- handleAvatarInput(event.currentTarget.files?.[0])
- }
+ <div class="flex items-center gap-3 border-b border-edge-muted pb-4">
+ <button
+ type="button"
+ aria-label="Upload avatar"
+ class="rounded-full outline-none focus-visible:ring-2 focus-visible:ring-accent"
+ onClick={() => avatarInputRef?.click()}
+ >
+ <AgentAvatar
+ agent={{
+ id: 'draft',
+ name: name() || 'Agent',
+ tag: tag(),
+ avatarUrl: avatarUrl(),
+ instructions: '',
+ harness: '',
+ defaultModel: '',
+ channelSummary: '',
+ share: share(),
+ }}
/>
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={() => avatarInputRef?.click()}
- >
- <UploadIcon />
- Upload
- </Button>
- </div>
-
- <div class="mt-4 grid grid-cols-2 gap-3 mobile:grid-cols-1">
- <label class="flex flex-col gap-1.5">
- <span class="text-xs font-medium text-ink">Name</span>
- <input
- autofocus
- class="settings-input w-full"
- placeholder="Bug fixer"
- value={name()}
- onInput={(event) =>
- handleNameInput(event.currentTarget.value)
- }
- />
- </label>
- <label for="agent-tag" class="flex flex-col gap-1.5">
- <span class="text-xs font-medium text-ink">@tag</span>
- <div class="flex items-center rounded-lg border border-edge-muted px-2 focus-within:border-accent">
- <span class="text-sm text-ink-extra-muted">@</span>
- <input
- id="agent-tag"
- aria-label="@tag"
- class="min-w-0 flex-1 bg-transparent px-1.5 py-2 text-sm text-ink outline-none"
- placeholder="bug-fixer"
- value={tag()}
- onInput={(event) => {
- setTagEdited(true);
- setTag(slugAgentTag(event.currentTarget.value));
- }}
- />
- </div>
- </label>
+ </button>
+ <div class="min-w-0 flex-1">
+ <div class="text-sm font-medium text-ink">Avatar</div>
+ <div class="mt-0.5 text-xs text-ink-muted">
+ Optional · square images work best
+ </div>
</div>
- </AgentFormSection>
+ <input
+ ref={avatarInputRef}
+ type="file"
+ accept="image/*"
+ class="hidden"
+ onChange={(event) =>
+ handleAvatarInput(event.currentTarget.files?.[0])
+ }
+ />
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={() => avatarInputRef?.click()}
+ >
+ <UploadIcon />
+ Upload
+ </Button>
+ </div>
- <AgentFormSection
- title="Behavior"
- description="Instructions the agent receives at the start of every conversation."
- >
+ <div class="mt-4 grid grid-cols-1 gap-3 @min-[440px]:grid-cols-2">
<label class="flex flex-col gap-1.5">
- <span class="text-xs font-medium text-ink">System prompt</span>
- <textarea
- rows={5}
- class="settings-input h-auto min-h-30 w-full resize-y px-3 py-2.5 font-mono text-xs leading-5"
- placeholder="You are a bug-fixing agent. Reproduce issues, identify root causes, and make focused, tested fixes…"
- value={instructions()}
+ <span class="text-xs font-medium text-ink">Name</span>
+ <input
+ autofocus
+ class="settings-input w-full"
+ placeholder="Bug fixer"
+ value={name()}
onInput={(event) =>
- setSystemPrompt(event.currentTarget.value)
+ handleNameInput(event.currentTarget.value)
}
/>
</label>
- </AgentFormSection>
+ <label for="agent-tag" class="flex flex-col gap-1.5">
+ <span class="text-xs font-medium text-ink">@tag</span>
+ <div class="flex items-center rounded-lg border border-edge-muted px-2 focus-within:border-accent">
+ <span class="text-sm text-ink-extra-muted">@</span>
+ <input
+ id="agent-tag"
+ aria-label="@tag"
+ class="min-w-0 flex-1 bg-transparent px-1.5 py-2 text-sm text-ink outline-none"
+ placeholder="bug-fixer"
+ value={tag()}
+ onInput={(event) => {
+ setTagEdited(true);
+ setTag(slugAgentTag(event.currentTarget.value));
+ }}
+ />
+ </div>
+ </label>
+ </div>
+ </AgentFormSection>
- <AgentFormSection
- title="Runtime"
- description="Harnesses and models are limited to those currently connected."
- >
- <div class="grid grid-cols-2 gap-3 mobile:grid-cols-1">
- <label class="flex flex-col gap-1.5">
- <span class="text-xs font-medium text-ink">Harness</span>
- <select
- class="settings-input w-full"
- onChange={(event) =>
- handleHarnessChange(event.currentTarget.value)
- }
- >
- <For
- each={props.connectedHarnesses.filter(
- (harness) =>
- harness.id !== 'claude-cloud' ||
- harness.id === harnessId() ||
- modelDataForHarness(harness.id)?.status ===
- 'available'
- )}
+ <AgentFormSection
+ title="Instructions"
+ description="Instructions the agent receives at the start of every conversation."
+ >
+ <AgentInstructionsEditor
+ markdown={instructions()}
+ onChange={setInstructions}
+ disabled={props.pending}
+ class="rounded-lg border border-edge-muted bg-input px-3 py-2.5 focus-within:border-accent"
+ placeholder="Describe your agent’s role, how it should work, and what a good result looks like…"
+ />
+ </AgentFormSection>
+
+ <AgentFormSection
+ title="Runtime"
+ description="Choose a connected runtime, then the model this agent uses."
+ >
+ <div class="grid grid-cols-1 gap-3 @min-[440px]:grid-cols-2">
+ <div class="flex min-w-0 flex-col gap-1.5">
+ <span class="text-xs font-medium text-ink">Runtime</span>
+ <SettingsSelect
+ label="Runtime"
+ options={props.connectedHarnesses.filter(
+ (harness) =>
+ harness.id !== 'claude-cloud' ||
+ harness.id === harnessId() ||
+ modelDataForHarness(harness.id)?.status === 'available'
+ )}
+ value={harnessId()}
+ onChange={handleHarnessChange}
+ />
+ </div>
+ <div class="flex min-w-0 flex-col gap-1.5">
+ <span class="text-xs font-medium text-ink">Default model</span>
+ <Show
+ when={selectedModelQuery()}
+ fallback={
+ <p class="settings-input text-ink-muted">
+ Model discovery unavailable
+ </p>
+ }
+ keyed
+ >
+ {(query) => (
+ <Show
+ when={!query.isPending}
+ fallback={
+ <SettingsSelect
+ label="Default model"
+ options={[]}
+ placeholder="Loading models…"
+ onChange={setDefaultModelId}
+ disabled
+ />
+ }
>
- {(harness) => (
- <option
- value={harness.id}
- selected={harness.id === harnessId()}
- >
- {harness.name}
- </option>
- )}
- </For>
- </select>
- </label>
- <label class="flex flex-col gap-1.5">
- <span class="text-xs font-medium text-ink">
- Default model
- </span>
- <Show
- when={selectedModelQuery()}
- fallback={
- <p class="settings-input text-ink-muted">
- Model discovery unavailable
- </p>
- }
- keyed
- >
- {(query) => (
<Show
- when={!query.isPending}
+ when={!query.isError}
fallback={
- <select
- aria-label="Default model"
- class="settings-input w-full"
- disabled
- >
- <option>Loading models…</option>
- </select>
+ <div class="flex items-center gap-2">
+ <p class="min-w-0 flex-1 text-xs text-negative">
+ Could not load models for{' '}
+ {selectedHarness()?.name ?? 'this runtime'}.
+ </p>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ aria-label={`Retry models for ${selectedHarness()?.name ?? 'this runtime'}`}
+ onClick={() => void query.refetch()}
+ >
+ Retry
+ </Button>
+ </div>
}
>
<Show
- when={!query.isError}
+ when={selectedModelData()?.status === 'available'}
fallback={
- <div class="flex items-center gap-2">
- <p class="min-w-0 flex-1 text-xs text-negative">
- Could not load models for{' '}
- {selectedHarness()?.name ?? 'this harness'}.
- </p>
- <Button
- type="button"
- variant="outline"
- size="sm"
- aria-label={`Retry models for ${selectedHarness()?.name ?? 'this harness'}`}
- onClick={() => void query.refetch()}
- >
- Retry
- </Button>
- </div>
+ <p class="settings-input text-ink-muted">
+ Model selection is unsupported by this runtime.
+ </p>
}
>
<Show
- when={selectedModelData()?.status === 'available'}
+ when={selectedModelOptions().length > 0}
fallback={
<p class="settings-input text-ink-muted">
- Model selection is unsupported by this harness.
+ This runtime did not return any models.
</p>
}
>
<Show
- when={selectedModelOptions().length > 0}
+ when={selectedHarnessUsesCatalog()}
fallback={
- <p class="settings-input text-ink-muted">
- This harness did not return any models.
- </p>
- }
- >
- <Show
- when={selectedHarnessUsesCatalog()}
- fallback={
- <select
- aria-label="Default model"
- class="settings-input w-full"
- value={selectedDefaultModelId()}
- onChange={(event) =>
- setDefaultModelId(
- event.currentTarget.value
- )
- }
- >
- <For each={selectedModelOptions()}>
- {(model) => (
- <option value={model.id}>
- {model.name}
- </option>
- )}
- </For>
- </select>
- }
- >
- <ModelCatalogPicker
+ <SettingsSelect
+ label="Default model"
+ options={selectedModelOptions()}
value={selectedDefaultModelId()}
- options={selectedCatalogOptions()}
- onSelect={setDefaultModelId}
- ariaLabel="Default model"
- triggerClass="w-full justify-between"
- contentClass="overflow-hidden"
+ onChange={setDefaultModelId}
/>
- </Show>
+ }
+ >
+ <ModelCatalogPicker
+ value={selectedDefaultModelId()}
+ options={selectedCatalogOptions()}
+ onSelect={setDefaultModelId}
+ ariaLabel="Default model"
+ triggerClass="w-full justify-between"
+ contentClass="overflow-hidden"
+ />
</Show>
</Show>
</Show>
</Show>
- )}
- </Show>
- </label>
+ </Show>
+ )}
+ </Show>
</div>
- <Show when={selectedHarness()?.kind === 'macrod'}>
- <fieldset class="mt-4 grid gap-2 border-t border-ink/[0.06] pt-4">
- <legend class="text-xs font-medium text-ink">
- Permission requests
- </legend>
+ </div>
+ <Show when={selectedHarness()?.kind === 'macrod'}>
+ <fieldset class="mt-4 grid gap-2 border-t border-ink/[0.06] pt-4">
+ <legend class="text-xs font-medium text-ink">
+ Permission requests
+ </legend>
+ <ChoiceRow
+ name="agent-permission-policy"
+ value="prompt"
+ title="Always prompt"
+ description="Session editors approve or reject each permission request."
+ checked={!autoAcceptPermissions()}
+ onChange={() => setAutoAcceptChoice(false)}
+ />
+ <Show
+ when={allowPermissionBypass()}
+ fallback={
+ <p class="text-xs text-ink-muted">
+ This runtime requires permission prompts.
+ </p>
+ }
+ >
<ChoiceRow
name="agent-permission-policy"
- value="prompt"
- title="Always prompt"
- description="Session editors approve or reject each permission request."
- checked={!autoAcceptPermissions()}
- onChange={() => setAutoAcceptChoice(false)}
+ value="bypass"
+ title="Always bypass"
+ description="Approve tool calls without asking."
+ checked={autoAcceptPermissions()}
+ onChange={() => setAutoAcceptChoice(true)}
/>
- <Show
- when={allowPermissionBypass()}
- fallback={
- <p class="text-xs text-ink-muted">
- This harness requires permission prompts.
- </p>
- }
- >
- <ChoiceRow
- name="agent-permission-policy"
- value="bypass"
- title="Always bypass"
- description="Approve tool calls without asking."
- checked={autoAcceptPermissions()}
- onChange={() => setAutoAcceptChoice(true)}
- />
- </Show>
- </fieldset>
- </Show>
- </AgentFormSection>
-
- <Show when={pipedreamMcp()}>
- <AgentFormSection
- title="Connections"
- description="Which connected apps (MCP tools) this agent can use."
- >
- <fieldset class="flex flex-col gap-2">
- <legend class="sr-only">Connections</legend>
- <ChoiceRow
- name="agent-mcp-mode"
- value="owner_connections"
- checked={mcp().scope === 'owner_connections'}
- title="Use my connected apps"
- description="The agent uses whatever apps the person running it has connected."
- onChange={() => setMcpScope('owner_connections')}
- />
- <ChoiceRow
- name="agent-mcp-mode"
- value="selected"
- checked={mcp().scope === 'selected'}
- title="Specific apps"
- description="Pick apps from the catalog. Each person connects their own account."
- onChange={() => setMcpScope('selected')}
- />
- </fieldset>
-
- <Show when={mcp().scope === 'selected'}>
- <div class="mt-3 border-t border-edge-muted pt-3">
- <PipedreamAppPicker
- selected={selectedMcpServers()}
- onChange={setSelectedMcpServers}
- connectedSlugs={connections.slugs}
- connectionsReady={connections.ready}
- connectContainer={() => dialogContentRef}
- />
- </div>
</Show>
-
- <Show when={share() === 'Team'}>
- <p class="mt-3 border-t border-edge-muted pt-3 text-xs text-ink-extra-muted">
- Connections are personal. Teammates who use this agent
- connect these apps under Settings → Integrations; the
- indicators here show only your own.
- </p>
- </Show>
- </AgentFormSection>
+ </fieldset>
</Show>
+ </AgentFormSection>
+ <Show when={pipedreamMcp()}>
<AgentFormSection
- title="Channels"
- description="Choose whether this agent is global or channel-specific."
+ title="Connections"
+ description="Which connected apps (MCP tools) this agent can use."
>
<fieldset class="flex flex-col gap-2">
- <legend class="sr-only">Channels</legend>
+ <legend class="sr-only">Connections</legend>
<ChoiceRow
- name="agent-channel-mode"
- value="all"
- checked={channelMode() === 'all'}
- title="All channels"
- description="The agent can be mentioned in every channel, like @macro."
- onChange={() => setChannelMode('all')}
+ name="agent-mcp-mode"
+ value="owner_connections"
+ checked={mcp().scope === 'owner_connections'}
+ title="Use my connected apps"
+ description="The agent uses whatever apps the person running it has connected."
+ onChange={() => setMcpScope('owner_connections')}
/>
<ChoiceRow
- name="agent-channel-mode"
+ name="agent-mcp-mode"
value="selected"
- checked={channelMode() === 'selected'}
- title="Specific channels"
- description="Only members of selected channels can use this agent."
- onChange={() => setChannelMode('selected')}
+ checked={mcp().scope === 'selected'}
+ title="Specific apps"
+ description="Pick apps from the catalog. Each person connects their own account."
+ onChange={() => setMcpScope('selected')}
/>
</fieldset>
- <Show when={channelMode() === 'selected'}>
+ <Show when={mcp().scope === 'selected'}>
<div class="mt-3 border-t border-edge-muted pt-3">
- <ChannelMultiSelect
- channelIds={selectedChannelIds()}
- onChange={setSelectedChannelIds}
+ <PipedreamAppPicker
+ selected={selectedMcpServers()}
+ onChange={setSelectedMcpServers}
+ connectedSlugs={connections.slugs}
+ connectionsReady={connections.ready}
+ connectContainer={() => pageContentRef}
/>
</div>
</Show>
- </AgentFormSection>
- <AgentFormSection
- title="Share"
- description="Choose who owns and can configure this agent."
- >
- <fieldset class="grid grid-cols-2 gap-2 mobile:grid-cols-1">
- <legend class="sr-only">Share</legend>
- <ChoiceRow
- name="agent-share"
- value="private"
- checked={share() === 'Private'}
- title="Private"
- description={
- props.canMakePrivate
- ? 'Only you can use and manage this agent.'
- : 'Only the agent creator can make it private.'
- }
- disabled={!props.canMakePrivate}
- onChange={() => setShare('Private')}
- />
- <ChoiceRow
- name="agent-share"
- value="team"
- checked={share() === 'Team'}
- title="Team"
- description={
- props.canShareWithTeam
- ? 'Your team can use this agent in shared channels.'
- : 'Create or join a team before sharing agents.'
- }
- disabled={!props.canShareWithTeam}
- onChange={() => setShare('Team')}
- />
- </fieldset>
- <Show when={!props.canShareWithTeam}>
+ <Show when={share() === 'Team'}>
<p class="mt-3 border-t border-edge-muted pt-3 text-xs text-ink-extra-muted">
- Team agents need a team owner. Create or join a team in Team
- settings to enable this option.
+ Connections are personal. Teammates who use this agent connect
+ these apps under Agents → Connections; the indicators here
+ show only your own.
</p>
</Show>
</AgentFormSection>
- </form>
- </Panel.Body>
+ </Show>
+
+ <AgentFormSection
+ title="Channels"
+ description="Choose whether this agent is global or channel-specific."
+ >
+ <fieldset class="flex flex-col gap-2">
+ <legend class="sr-only">Channels</legend>
+ <ChoiceRow
+ name="agent-channel-mode"
+ value="all"
+ checked={channelMode() === 'all'}
+ title="All channels"
+ description="The agent can be mentioned in every channel, like @macro."
+ onChange={() => setChannelMode('all')}
+ />
+ <ChoiceRow
+ name="agent-channel-mode"
+ value="selected"
+ checked={channelMode() === 'selected'}
+ title="Specific channels"
+ description="Only members of selected channels can use this agent."
+ onChange={() => setChannelMode('selected')}
+ />
+ </fieldset>
- <Panel.Footer class="justify-end gap-2 px-3 py-2">
- <Button type="button" variant="ghost" size="sm" onClick={close}>
+ <Show when={channelMode() === 'selected'}>
+ <div class="mt-3 border-t border-edge-muted pt-3">
+ <ChannelMultiSelect
+ channelIds={selectedChannelIds()}
+ onChange={setSelectedChannelIds}
+ />
+ </div>
+ </Show>
+ </AgentFormSection>
+
+ <AgentFormSection
+ title="Share"
+ description="Choose who owns and can configure this agent."
+ >
+ <fieldset class="grid grid-cols-1 gap-2 @min-[440px]:grid-cols-2">
+ <legend class="sr-only">Share</legend>
+ <ChoiceRow
+ name="agent-share"
+ value="private"
+ checked={share() === 'Private'}
+ title="Private"
+ description={
+ props.canMakePrivate
+ ? 'Only you can use and manage this agent.'
+ : 'Only the agent creator can make it private.'
+ }
+ disabled={!props.canMakePrivate}
+ onChange={() => setShare('Private')}
+ />
+ <ChoiceRow
+ name="agent-share"
+ value="team"
+ checked={share() === 'Team'}
+ title="Team"
+ description={
+ props.canShareWithTeam
+ ? 'Your team can use this agent in shared channels.'
+ : 'Create or join a team before sharing agents.'
+ }
+ disabled={!props.canShareWithTeam}
+ onChange={() => setShare('Team')}
+ />
+ </fieldset>
+ <Show when={!props.canShareWithTeam}>
+ <p class="mt-3 border-t border-edge-muted pt-3 text-xs text-ink-extra-muted">
+ Team agents need a team owner. Create or join a team in Team
+ settings to enable this option.
+ </p>
+ </Show>
+ </AgentFormSection>
+ </form>
+ <div class="mt-6 flex justify-end gap-2 border-t border-edge-muted pt-4">
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ onClick={close}
+ disabled={props.pending}
+ >
Cancel
</Button>
<Button
@@ -1187,9 +1166,9 @@ function AgentDialog(props: {
? 'Save changes'
: 'Create agent'}
</Button>
- </Panel.Footer>
- </Panel>
- </Dialog>
+ </div>
+ </section>
+ </SettingsPage>
);
}
diff --git a/apps/web/src/features/settings/Email.tsx b/apps/web/src/features/settings/Email.tsx
index bd71e49ec3..4dd3775de7 100644
--- a/apps/web/src/features/settings/Email.tsx
+++ b/apps/web/src/features/settings/Email.tsx
@@ -18,12 +18,13 @@ import {
useEmailLinks,
useEmailLinksStatus,
} from '@core/email-link';
+import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
import GmailIcon from '@icon/mcp-gmail.svg';
import ArrowsClockwiseIcon from '@phosphor-icons/core/regular/arrows-clockwise.svg?component-solid';
import CalendarSlashIcon from '@phosphor-icons/core/regular/calendar-slash.svg?component-solid';
import PlusIcon from '@phosphor-icons/core/regular/plus.svg?component-solid';
import SignatureIcon from '@phosphor-icons/core/regular/signature.svg?component-solid';
-import XIcon from '@phosphor-icons/core/regular/x.svg?component-solid';
+import TrashIcon from '@phosphor-icons/core/regular/trash.svg?component-solid';
import {
type BackfillProgress,
estimateEtaSeconds,
@@ -419,8 +420,27 @@ function InboxRow(props: {
const calendarUiEnabled = useCalendarUiFlag();
const showSignature = () => isSignatureExpanded(props.link.id);
const signatureSectionId = `signature-section-${props.link.id}`;
+ const [attachHotkeys, signatureHotkeyScope] =
+ useHotkeyDOMScope('email-signature');
+ let signatureTrigger: HTMLButtonElement | undefined;
+ const closeSignature = () => {
+ if (!showSignature()) return;
+ toggleSignatureExpanded(props.link.id);
+ signatureTrigger?.focus();
+ };
+ registerHotkey({
+ scopeId: signatureHotkeyScope,
+ hotkey: 'escape',
+ description: 'Close signature editor',
+ condition: showSignature,
+ runWithInputFocused: true,
+ keyDownHandler: () => {
+ closeSignature();
+ return true;
+ },
+ });
return (
- <div class="bg-surface flex flex-col">
+ <div class="bg-surface flex flex-col" ref={attachHotkeys}>
<div class="flex items-center justify-between gap-3 min-h-15.25 py-2 px-6">
<div class="min-w-0 flex flex-col gap-0.5">
<div class="flex items-center gap-2 min-w-0">
@@ -483,6 +503,7 @@ function InboxRow(props: {
variant="outline"
size="icon-sm"
depth={3}
+ ref={signatureTrigger}
onClick={() => toggleSignatureExpanded(props.link.id)}
aria-label={`Edit signature for ${props.link.email_address}`}
aria-expanded={showSignature()}
@@ -576,7 +597,7 @@ function InboxRow(props: {
onClick={props.onRemove}
aria-label={`Remove ${props.link.email_address}`}
>
- <XIcon class="size-4" />
+ <TrashIcon class="size-4" />
</Button>
</Tooltip>
</div>
@@ -585,7 +606,7 @@ function InboxRow(props: {
when={emailSignaturesFlag().enabled && props.isOwn && showSignature()}
>
<div id={signatureSectionId} class="px-6 pb-4">
- <SignatureSection link={props.link} />
+ <SignatureSection link={props.link} onClose={closeSignature} />
</div>
</Show>
</div>
diff --git a/apps/web/src/features/settings/Harness.test.tsx b/apps/web/src/features/settings/Harness.test.tsx
index 34fe723ea3..f569e7d9e3 100644
--- a/apps/web/src/features/settings/Harness.test.tsx
+++ b/apps/web/src/features/settings/Harness.test.tsx
@@ -24,6 +24,12 @@ import {
import { Suspense } from 'solid-js';
import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { Harness } from './Harness';
+import { chooseSelectOption } from './tests/select-helpers';
+
+vi.mock('@ui', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('@ui')>()),
+ confirmDialog: vi.fn(async () => true),
+}));
vi.mock('./codex/views/CodexHarness', () => ({
CodexHarness: () => <div data-testid="codex-harness" />,
@@ -273,11 +279,7 @@ describe('Harness', () => {
expect(screen.queryByText('Settings suspended')).toBeNull();
expect(screen.getByText('Loading models…')).toBeTruthy();
expect(
- (
- screen.getByRole('combobox', {
- name: 'Default model',
- }) as HTMLSelectElement
- ).disabled
+ (screen.getByLabelText('Default model') as HTMLButtonElement).disabled
).toBe(true);
if (outcome === 'error') {
@@ -300,17 +302,11 @@ describe('Harness', () => {
],
});
await waitFor(() =>
- expect(
- screen.getByRole('option', { name: 'Loaded Model' })
- ).toBeTruthy()
+ expect(screen.getByText('Loaded Model')).toBeTruthy()
);
expect(screen.queryByText('Settings suspended')).toBeNull();
expect(
- (
- screen.getByRole('combobox', {
- name: 'Default model',
- }) as HTMLSelectElement
- ).disabled
+ (screen.getByLabelText('Default model') as HTMLButtonElement).disabled
).toBe(false);
}
view.unmount();
@@ -330,9 +326,11 @@ describe('Harness', () => {
).toBeTruthy();
expect(screen.getByLabelText('Anthropic')).toBeTruthy();
expect(
- screen.getByRole('heading', { name: 'Bring your own agent' })
+ screen.getByRole('heading', { name: 'Bring your agent to Macro' })
+ ).toBeTruthy();
+ expect(
+ screen.getByText(/Uses official Macro tools and MCPs to get the job done/)
).toBeTruthy();
- expect(screen.getByText(/This is not a coding harness/)).toBeTruthy();
});
it('validates and saves a Cursor API key', async () => {
@@ -368,6 +366,10 @@ describe('Harness', () => {
defaultModelId: null,
updatedAt: '2026-08-27T12:00:00Z',
};
+ mocks.models.data.models.push({
+ id: 'another-model',
+ name: 'Another Model',
+ });
render(() => <Harness />);
@@ -375,11 +377,9 @@ describe('Harness', () => {
expect(screen.queryByLabelText('API key')).toBeNull();
expect(screen.getByText(/does not revoke it in Cursor/)).toBeTruthy();
- fireEvent.change(screen.getByLabelText('Default model'), {
- target: { value: 'default-model' },
- });
+ chooseSelectOption(screen.getByLabelText('Default model'), 'Another Model');
await waitFor(() => {
- expect(mocks.setDefaultModel).toHaveBeenCalledWith('default-model');
+ expect(mocks.setDefaultModel).toHaveBeenCalledWith('another-model');
expect(mocks.toastSuccess).toHaveBeenCalledWith('Default model updated');
});
@@ -400,22 +400,38 @@ describe('Harness', () => {
expect(screen.queryByLabelText('API key')).toBeNull();
});
- it('links the empty BYOA list to the setup documentation', () => {
+ it('hides the empty paired runtimes section and keeps the setup guide', () => {
render(() => <Harness />);
- expect(screen.getByText('No agents connected')).toBeTruthy();
+ expect(screen.queryByText('No paired runtimes yet')).toBeNull();
+ expect(
+ screen.queryByRole('heading', { name: 'Paired runtimes' })
+ ).toBeNull();
+ expect(
+ screen.queryByRole('button', { name: 'Enter pairing code' })
+ ).toBeNull();
expect(screen.getByRole('link', { name: /Setup guide/ })).toHaveProperty(
'href',
'https://docs.macro.com/AI/bring-your-own'
);
});
- it('offers "Enter pairing code" in the header and empty state', () => {
+ it('opens pairing from the bring-your-own card', () => {
render(() => <Harness />);
+ expect(screen.getAllByRole('button', { name: 'New runtime' })).toHaveLength(
+ 2
+ );
+ const card = screen
+ .getByRole('heading', { name: 'Bring your agent to Macro' })
+ .closest('section')!;
+ fireEvent.click(within(card).getByRole('button', { name: 'New runtime' }));
+ expect(screen.getByRole('region', { name: 'New runtime' })).toBeTruthy();
+ expect(screen.queryByRole('dialog')).toBeNull();
+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));
expect(
- screen.getAllByRole('button', { name: 'Enter pairing code' })
- ).toHaveLength(2);
+ screen.getByRole('heading', { name: 'Bring your agent to Macro' })
+ ).toBeTruthy();
});
it('renders a registered harness row', () => {
@@ -456,19 +472,19 @@ describe('Harness', () => {
const dialog = screen.getByRole('dialog');
expect(within(dialog).getByText('Remove Dev box?')).toBeTruthy();
expect(
- within(dialog).getByText(/Agents using this harness will stop running/)
+ within(dialog).getByText(/Agents using this runtime will stop running/)
).toBeTruthy();
expect(harnessMocks.deleteHarness).not.toHaveBeenCalled();
fireEvent.click(
- within(dialog).getByRole('button', { name: 'Remove harness' })
+ within(dialog).getByRole('button', { name: 'Remove runtime' })
);
await waitFor(() => {
expect(harnessMocks.deleteHarness).toHaveBeenCalledWith({
harnessId: REGISTERED_HARNESS.id,
});
- expect(mocks.toastSuccess).toHaveBeenCalledWith('Harness removed');
+ expect(mocks.toastSuccess).toHaveBeenCalledWith('Runtime removed');
expect(screen.queryByRole('dialog')).toBeNull();
});
});
@@ -478,7 +494,8 @@ describe('Harness', () => {
render(() => <Harness />);
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: 'New runtime' });
+ expect(screen.queryByRole('dialog')).toBeNull();
expect(within(dialog).getByText('KX7M-4QHD')).toBeTruthy();
expect(within(dialog).getByText('Dev laptop')).toBeTruthy();
expect(harnessMocks.setSearchParams).toHaveBeenCalledWith(
diff --git a/apps/web/src/features/settings/Harness.tsx b/apps/web/src/features/settings/Harness.tsx
index 807794e584..b2b650452d 100644
--- a/apps/web/src/features/settings/Harness.tsx
+++ b/apps/web/src/features/settings/Harness.tsx
@@ -4,9 +4,8 @@ import { toast } from '@core/component/Toast/Toast';
import { MACRO_HARNESS_NAME } from '@core/constant/macroAgent';
import { ThrownResultError } from '@core/util/result';
import CursorIcon from '@icon/wide-cursor-ide.svg';
-import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';
import HardDrivesIcon from '@phosphor/hard-drives.svg';
-import TerminalWindowIcon from '@phosphor/terminal-window.svg';
+import PlusIcon from '@phosphor/plus.svg';
import { useAgentModelsQuery } from '@queries/agents/models';
import {
useCursorApiKeyStatusQuery,
@@ -20,15 +19,17 @@ import {
} from '@queries/harnesses/harnesses';
import type { Harness as RegisteredHarness } from '@service-storage/client';
import { useSearchParams } from '@solidjs/router';
-import { Button, Dialog, Panel } from '@ui';
-import { createSignal, For, onMount, Show } from 'solid-js';
+import { Button, confirmDialog, Dialog, Panel } from '@ui';
+import { createSignal, For, type JSX, onMount, Show } from 'solid-js';
import { ClaudeConnection } from '../claude-connection/claude-connection';
import { CodexHarness } from './codex/views/CodexHarness';
-import { HarnessPairingDialog } from './HarnessPairingDialog';
+import { AgentSettingsDescription } from './components/agent-settings-description';
+import { BringYourOwnAgent } from './components/bring-your-own-agent';
+import { SettingsSelect } from './components/settings-select';
import { ConnectAction, HarnessIcon, StatusDot } from './integration-ui';
import { SettingsCard, SettingsPage } from './primitives';
+import { RuntimePairingPage } from './RuntimePairingPage';
-const BYOA_DOCS_URL = 'https://docs.macro.com/AI/bring-your-own';
const CURSOR_KEY_PREFIX = 'crsr_';
function failureMessage(error: unknown, fallback: string): string {
@@ -42,7 +43,9 @@ function lastConnectedText(harness: RegisteredHarness): string {
}
/** Settings UI for choosing and configuring the available agent harnesses. */
-export function Harness() {
+export function Harness(
+ props: { navigation?: JSX.Element; startPairing?: boolean } = {}
+) {
const [cursorApiKey, setCursorApiKey] = createSignal('');
const cursorStatus = useCursorApiKeyStatusQuery();
const saveCursorApiKey = useSaveCursorApiKey();
@@ -51,9 +54,15 @@ export function Harness() {
cursorStatus.isSuccess ? cursorStatus.data.registered : false;
const harnessesQuery = useHarnessesQuery();
const deleteHarnessMutation = useDeleteHarnessMutation();
- const [pairingDialog, setPairingDialog] = createSignal<{
- initialCode?: string;
- }>();
+ const [pairingDialog, setPairingDialog] = createSignal<
+ | {
+ initialCode?: string;
+ }
+ | undefined
+ >(props.startPairing ? {} : undefined);
+ const closePairing = () => {
+ setPairingDialog(undefined);
+ };
const [removingHarness, setRemovingHarness] =
createSignal<RegisteredHarness>();
const [searchParams, setSearchParams] = useSearchParams();
@@ -73,9 +82,9 @@ export function Harness() {
try {
await deleteHarnessMutation.mutateAsync({ harnessId: current.id });
setRemovingHarness(undefined);
- toast.success('Harness removed');
+ toast.success('Runtime removed');
} catch (error) {
- toast.failure(failureMessage(error, 'Failed to remove harness'));
+ toast.failure(failureMessage(error, 'Failed to remove runtime'));
}
};
@@ -112,6 +121,7 @@ export function Harness() {
}));
const selectedCursorModelId = () =>
(cursorStatus.isSuccess ? cursorStatus.data.defaultModelId : null) ??
+ cursorModelData()?.currentModel ??
cursorModelOptions()[0]?.id ??
null;
@@ -143,6 +153,14 @@ export function Harness() {
};
const handleDisconnectCursor = async () => {
+ if (disconnectCursor.isPending) return;
+ const confirmed = await confirmDialog({
+ title: 'Disconnect Cursor?',
+ body: "Remove your Cursor connection from Macro? This removes Macro's copy of the API key but does not revoke it in Cursor.",
+ confirmLabel: 'Disconnect',
+ tone: 'danger',
+ });
+ if (!confirmed || disconnectCursor.isPending) return;
try {
await disconnectCursor.mutateAsync();
setCursorApiKey('');
@@ -153,327 +171,311 @@ export function Harness() {
};
return (
- <SettingsPage
- title="Harness"
- description="Configure how agents run for your Macro workspace."
- >
- <SettingsCard>
- <section class="flex gap-4 px-6 py-5">
- <HarnessIcon>
- <HardDrivesIcon />
- </HarnessIcon>
- <div class="min-w-0 flex-1">
- <div class="flex items-center gap-2">
- <h2 class="text-sm font-medium text-ink">{MACRO_HARNESS_NAME}</h2>
- <span class="rounded-full bg-success-bg px-2 py-0.5 text-[11px] font-medium text-success">
- Built in
- </span>
- </div>
- <p class="mt-1 text-sm text-ink-muted">
- Macro Agent runs directly in your workspace. It is ready to use
- and does not require any configuration. This is not a coding
- harness.
- </p>
- </div>
- </section>
-
- <ClaudeConnection />
+ <>
+ <Show when={!pairingDialog()}>
+ <SettingsPage
+ title={props.navigation ? 'Agents' : 'Runtimes'}
+ description={<AgentSettingsDescription />}
+ actions={
+ <Button
+ variant="cta"
+ size="sm"
+ onClick={() => setPairingDialog({})}
+ >
+ <PlusIcon />
+ New runtime
+ </Button>
+ }
+ >
+ <BringYourOwnAgent onAddRuntime={() => setPairingDialog({})} />
+ {props.navigation}
+ <div>
+ <h2 class="mb-3 px-6 text-sm font-semibold text-ink">
+ Built-in runtimes
+ </h2>
+ <SettingsCard>
+ <section class="flex gap-4 px-6 py-5">
+ <HarnessIcon>
+ <HardDrivesIcon />
+ </HarnessIcon>
+ <div class="min-w-0 flex-1">
+ <div class="flex min-h-5 items-start justify-between gap-3">
+ <h2 class="min-w-0 text-sm/5 font-medium text-ink">
+ {MACRO_HARNESS_NAME}
+ </h2>
+ <span class="inline-flex h-5 shrink-0 items-center whitespace-nowrap rounded-md bg-success-bg px-2 text-[11px]/none font-medium text-success">
+ Built in
+ </span>
+ </div>
+ <p class="mt-1 text-sm text-ink-muted">
+ Macro in house fast and powerful agent. Uses official Macro
+ tools and MCPs to get the job done.
+ </p>
+ </div>
+ </section>
- <section class="flex gap-4 px-6 py-5">
- <HarnessIcon>
- <CursorIcon />
- </HarnessIcon>
- <div class="min-w-0 flex-1">
- <div class="flex items-center gap-2">
- <h2 class="text-sm font-medium text-ink">Cursor</h2>
- <Show when={cursorRegistered()}>
- <span class="rounded-full bg-success-bg px-2 py-0.5 text-[11px] font-medium text-success">
- Connected
- </span>
- </Show>
- </div>
- <p class="mt-1 text-sm text-ink-muted">
- Use your Cursor account to run agent sessions in Macro.
- </p>
+ <ClaudeConnection />
- <Show
- when={cursorStatus.isSuccess && !cursorStatus.isPlaceholderData}
- fallback={
- <p class="mt-4 text-xs text-ink-muted">
- {cursorStatus.isError
- ? 'Could not load your Cursor connection. Try refreshing this page.'
- : 'Loading…'}
- </p>
- }
- >
- <Show
- when={cursorRegistered()}
- fallback={
- <div class="mt-4 flex flex-col gap-1.5">
- <label
- for="cursor-harness-api-key"
- class="text-xs text-ink"
- >
- API key
- </label>
- <div class="flex items-center gap-2 mobile:flex-col mobile:items-stretch">
- <input
- id="cursor-harness-api-key"
- type="password"
- autocomplete="off"
- spellcheck={false}
- class="settings-input ph-no-capture min-w-0 flex-1"
- placeholder={`${CURSOR_KEY_PREFIX}…`}
- value={cursorApiKey()}
- onInput={(event) =>
- setCursorApiKey(event.currentTarget.value)
- }
- onKeyDown={(event) => {
- if (event.key === 'Enter') {
- void handleSaveCursorApiKey();
- }
- }}
- />
- <Button
- type="button"
- variant="outline"
- size="sm"
- depth={3}
- disabled={
- cursorApiKey().trim().length === 0 ||
- saveCursorApiKey.isPending
- }
- onClick={handleSaveCursorApiKey}
- >
- Save
- </Button>
- </div>
- <p class="text-xs text-ink-extra-muted">
- Create an API key in Cursor and paste it here. Macro
- stores it encrypted.
- </p>
+ <section class="flex gap-4 px-6 py-5">
+ <HarnessIcon>
+ <CursorIcon />
+ </HarnessIcon>
+ <div class="min-w-0 flex-1">
+ <div class="flex min-h-5 items-start justify-between gap-3">
+ <h2 class="min-w-0 text-sm/5 font-medium text-ink">
+ Cursor
+ </h2>
+ <Show when={cursorRegistered()}>
+ <span class="inline-flex h-5 shrink-0 items-center whitespace-nowrap rounded-md bg-success-bg px-2 text-[11px]/none font-medium text-success">
+ Connected
+ </span>
+ </Show>
</div>
- }
- >
- <div class="mt-4 flex flex-col gap-1.5">
- <label for="cursor-default-model" class="text-xs text-ink">
- Default model
- </label>
+ <p class="mt-1 text-sm text-ink-muted">
+ Bring your own Cursor subscription to Macro. Manage Cursor
+ Cloud sessions directly in the app.
+ </p>
+
<Show
- when={!cursorModels.isPending}
+ when={
+ cursorStatus.isSuccess && !cursorStatus.isPlaceholderData
+ }
fallback={
- <select
- id="cursor-default-model"
- class="settings-input w-56"
- disabled
- >
- <option>Loading models…</option>
- </select>
+ <p class="mt-4 text-xs text-ink-muted">
+ {cursorStatus.isError
+ ? 'Could not load your Cursor connection. Try refreshing this page.'
+ : 'Loading…'}
+ </p>
}
>
<Show
- when={!cursorModels.isError}
+ when={cursorRegistered()}
fallback={
- <div class="flex items-center gap-2">
- <p class="text-xs text-negative">
- Could not load Cursor models.
- </p>
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={() => void cursorModels.refetch()}
+ <div class="mt-4 flex flex-col gap-1.5">
+ <label
+ for="cursor-harness-api-key"
+ class="text-xs text-ink"
>
- Retry
- </Button>
+ API key
+ </label>
+ <div class="flex items-center gap-2 mobile:flex-col mobile:items-stretch">
+ <input
+ id="cursor-harness-api-key"
+ type="password"
+ autocomplete="off"
+ spellcheck={false}
+ class="settings-input ph-no-capture min-w-0 flex-1"
+ placeholder={`${CURSOR_KEY_PREFIX}…`}
+ value={cursorApiKey()}
+ onInput={(event) =>
+ setCursorApiKey(event.currentTarget.value)
+ }
+ onKeyDown={(event) => {
+ if (event.key === 'Enter') {
+ void handleSaveCursorApiKey();
+ }
+ }}
+ />
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ depth={3}
+ disabled={
+ cursorApiKey().trim().length === 0 ||
+ saveCursorApiKey.isPending
+ }
+ onClick={handleSaveCursorApiKey}
+ >
+ Save
+ </Button>
+ </div>
+ <p class="text-xs text-ink-extra-muted">
+ Create an API key in Cursor and paste it here. Macro
+ stores it encrypted.
+ </p>
</div>
}
>
- <Show
- when={cursorModelData()?.status === 'available'}
- fallback={
- <p class="text-xs text-ink-muted">
- Cursor does not support model selection.
- </p>
- }
- >
- <Show
- when={isLargeModelCatalog(cursorCatalogOptions())}
- fallback={
- <select
- id="cursor-default-model"
- class="settings-input w-56"
- value={
- cursorStatus.data?.defaultModelId ??
- cursorModelData()?.currentModel ??
- cursorModelOptions()[0]?.id ??
- ''
- }
- disabled={setCursorDefaultModel.isPending}
- onChange={(event) =>
- void handleCursorModelChange(
- event.currentTarget.value
- )
+ <div class="mt-4 flex flex-col gap-3">
+ <div class="flex w-full max-w-60 flex-col gap-1.5">
+ <span class="text-xs font-medium text-ink">
+ Default model
+ </span>
+ <Show
+ when={!cursorModels.isPending}
+ fallback={
+ <SettingsSelect
+ label="Default model"
+ options={[]}
+ placeholder="Loading models…"
+ onChange={(id) =>
+ void handleCursorModelChange(id)
+ }
+ disabled
+ />
+ }
+ >
+ <Show
+ when={!cursorModels.isError}
+ fallback={
+ <div class="flex items-center gap-2">
+ <p class="text-xs text-negative">
+ Could not load Cursor models.
+ </p>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={() => void cursorModels.refetch()}
+ >
+ Retry
+ </Button>
+ </div>
}
>
- <For each={cursorModelOptions()}>
- {(model) => (
- <option value={model.id}>{model.name}</option>
- )}
- </For>
- </select>
- }
+ <Show
+ when={cursorModelData()?.status === 'available'}
+ fallback={
+ <p class="text-xs text-ink-muted">
+ Cursor does not support model selection.
+ </p>
+ }
+ >
+ <Show
+ when={isLargeModelCatalog(
+ cursorCatalogOptions()
+ )}
+ fallback={
+ <SettingsSelect
+ label="Default model"
+ options={cursorModelOptions()}
+ value={selectedCursorModelId()}
+ disabled={setCursorDefaultModel.isPending}
+ onChange={(id) =>
+ void handleCursorModelChange(id)
+ }
+ />
+ }
+ >
+ <ModelCatalogPicker
+ value={selectedCursorModelId()}
+ options={cursorCatalogOptions()}
+ onSelect={(id) =>
+ void handleCursorModelChange(id)
+ }
+ disabled={setCursorDefaultModel.isPending}
+ ariaLabel="Default model"
+ triggerClass="h-9 w-full justify-between text-base [&>span]:flex-1"
+ placement="bottom-start"
+ />
+ </Show>
+ </Show>
+ </Show>
+ </Show>
+ </div>
+ <p class="text-xs text-ink-extra-muted">
+ The model new `@cursor` sessions start on. Recommended
+ models stay up top; everything else is behind More
+ models.
+ </p>
+ </div>
+
+ <div class="mt-4 flex flex-wrap items-center justify-between gap-3">
+ <p class="flex-1 basis-56 text-xs text-ink-extra-muted">
+ Disconnecting removes Macro's copy of the key but does
+ not revoke it in Cursor.
+ </p>
+ <Button
+ type="button"
+ variant="danger"
+ size="sm"
+ depth={3}
+ class="shrink-0"
+ disabled={disconnectCursor.isPending}
+ onClick={handleDisconnectCursor}
>
- <ModelCatalogPicker
- value={selectedCursorModelId()}
- options={cursorCatalogOptions()}
- onSelect={(id) => void handleCursorModelChange(id)}
- disabled={setCursorDefaultModel.isPending}
- ariaLabel="Default model"
- triggerClass="w-72 max-w-full justify-between"
- />
- </Show>
- </Show>
+ Disconnect
+ </Button>
+ </div>
</Show>
</Show>
- <p class="text-xs text-ink-extra-muted">
- The model new `@cursor` sessions start on. Recommended
- models stay up top; everything else is behind More models.
- </p>
</div>
+ </section>
- <div class="mt-4 flex items-center justify-between gap-4 mobile:items-start">
- <p class="text-xs text-ink-extra-muted">
- Disconnecting removes Macro's copy of the key but does not
- revoke it in Cursor.
- </p>
- <Button
- type="button"
- variant="danger"
- size="sm"
- depth={3}
- class="shrink-0"
- disabled={disconnectCursor.isPending}
- onClick={handleDisconnectCursor}
- >
- Disconnect
- </Button>
- </div>
- </Show>
- </Show>
+ <CodexHarness />
+ </SettingsCard>
</div>
- </section>
-
- <CodexHarness />
- <section class="flex gap-4 px-6 py-5">
- <HarnessIcon>
- <TerminalWindowIcon />
- </HarnessIcon>
- <div class="min-w-0 flex-1">
- <div class="flex items-center justify-between gap-4">
- <h2 class="text-sm font-medium text-ink">Bring your own agent</h2>
- <div class="flex shrink-0 items-center gap-1">
- <Button
- type="button"
- variant="outline"
- size="sm"
- depth={3}
- onClick={() => setPairingDialog({})}
- >
- Enter pairing code
- </Button>
- <a
- href={BYOA_DOCS_URL}
- target="_blank"
- rel="noopener noreferrer"
- class="inline-flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium text-ink-muted outline-none transition-colors hover:bg-ink/4 hover:text-ink focus-visible:bg-ink/6"
+ <Show
+ when={!harnessesQuery.isSuccess || harnessesQuery.data.length > 0}
+ >
+ <div>
+ <h2 class="mb-3 px-6 text-sm font-semibold text-ink">
+ Paired runtimes
+ </h2>
+ <SettingsCard>
+ <For
+ each={harnessesQuery.isSuccess ? harnessesQuery.data : []}
+ fallback={
+ <div class="flex flex-col items-center py-6 text-center">
+ <p class="text-sm text-ink">
+ {harnessesQuery.isError
+ ? 'Could not load runtimes.'
+ : 'Loading runtimes…'}
+ </p>
+ </div>
+ }
>
- Setup guide
- <ArrowUpRightIcon class="size-3.5 opacity-70" />
- </a>
- </div>
- </div>
- <p class="mt-1 text-sm text-ink-muted">
- Install macrod on your computer to connect Claude or another
- compatible agent.
- </p>
-
- <div class="mt-5">
- <div class="text-xs font-medium text-ink-muted">
- Connected agents
- </div>
- <For
- each={harnessesQuery.isSuccess ? harnessesQuery.data : []}
- fallback={
- <div class="flex flex-col items-center py-6 text-center">
- <p class="text-sm text-ink">
- {harnessesQuery.isPending
- ? 'Loading connected agents…'
- : harnessesQuery.isError
- ? 'Could not load connected agents.'
- : 'No agents connected'}
- </p>
- <p class="mt-1 text-xs text-ink-extra-muted">
- Agents connected through macrod will appear here.
- </p>
- <Button
- type="button"
- variant="outline"
- size="sm"
- depth={3}
- class="mt-3"
- onClick={() => setPairingDialog({})}
- >
- Enter pairing code
- </Button>
- </div>
- }
- >
- {(harness) => (
- <div class="flex items-center justify-between gap-4 px-4 py-3">
- <div class="min-w-0">
- <div class="flex min-w-0 items-center gap-2">
- <p class="truncate text-sm text-ink">{harness.name}</p>
- <span class="shrink-0 rounded-full border border-edge-muted px-2 py-0.5 text-xxs font-medium uppercase text-ink-extra-muted">
- {harness.owner.type === 'team' ? 'Team' : 'Private'}
- </span>
- <StatusDot
- state={
- harness.connected ? 'connected' : 'disconnected'
- }
- label={
- harness.connected ? 'Connected' : 'Disconnected'
- }
+ {(harness) => (
+ <div class="flex items-center justify-between gap-4 px-4 py-3">
+ <div class="min-w-0 flex-1">
+ <div class="flex min-w-0 items-center gap-2">
+ <p class="min-w-0 flex-1 truncate text-sm text-ink">
+ {harness.name}
+ </p>
+ <span class="inline-flex h-5 shrink-0 items-center whitespace-nowrap rounded-md border border-edge-muted px-2 text-xxs/none font-medium uppercase text-ink-extra-muted">
+ {harness.owner.type === 'team' ? 'Team' : 'Private'}
+ </span>
+ <StatusDot
+ state={
+ harness.connected ? 'connected' : 'disconnected'
+ }
+ label={
+ harness.connected ? 'Connected' : 'Disconnected'
+ }
+ />
+ </div>
+ <p class="mt-0.5 truncate text-xs text-ink-extra-muted">
+ {lastConnectedText(harness)}
+ </p>
+ </div>
+ <div class="shrink-0">
+ <ConnectAction
+ label="Remove"
+ variant="danger"
+ onClick={() => setRemovingHarness(harness)}
/>
</div>
- <p class="mt-0.5 truncate text-xs text-ink-extra-muted">
- {lastConnectedText(harness)}
- </p>
</div>
- <ConnectAction
- label="Remove"
- variant="danger"
- onClick={() => setRemovingHarness(harness)}
- />
- </div>
- )}
- </For>
- <Show when={harnessesQuery.isError}>
- <p class="px-4 py-3 text-xs text-negative">
- Could not load your harnesses. Try refreshing this page.
- </p>
- </Show>
+ )}
+ </For>
+ <Show when={harnessesQuery.isError}>
+ <p class="px-4 py-3 text-xs text-negative">
+ Could not load your runtimes. Try refreshing this page.
+ </p>
+ </Show>
+ </SettingsCard>
</div>
- </div>
- </section>
- </SettingsCard>
+ </Show>
+ </SettingsPage>
+ </Show>
<Show when={pairingDialog()} keyed>
{(dialog) => (
- <HarnessPairingDialog
+ <RuntimePairingPage
initialCode={dialog.initialCode}
- onClose={() => setPairingDialog(undefined)}
+ onClose={closePairing}
/>
)}
</Show>
@@ -487,7 +489,7 @@ export function Harness() {
/>
)}
</Show>
- </SettingsPage>
+ </>
);
}
@@ -513,7 +515,7 @@ function HarnessRemoveDialog(props: {
</Panel.Header>
<Panel.Body class="p-5">
<Dialog.Description class="text-sm leading-5 text-ink-muted">
- Agents using this harness will stop running until it's reconnected.
+ Agents using this runtime will stop running until it's reconnected.
macrod on that machine will need to pair again.
</Dialog.Description>
</Panel.Body>
@@ -534,7 +536,7 @@ function HarnessRemoveDialog(props: {
disabled={props.pending}
onClick={props.onConfirm}
>
- {props.pending ? 'Removing…' : 'Remove harness'}
+ {props.pending ? 'Removing…' : 'Remove runtime'}
</Button>
</Panel.Footer>
</Panel>
diff --git a/apps/web/src/features/settings/McpConnections.tsx b/apps/web/src/features/settings/McpConnections.tsx
index e6dbb63060..5e1109eef4 100644
--- a/apps/web/src/features/settings/McpConnections.tsx
+++ b/apps/web/src/features/settings/McpConnections.tsx
@@ -1,27 +1,29 @@
+import { useSettingsState } from '@core/constant/SettingsState';
import { usePipedreamMcpFlag } from '@core/pipedream/flag';
import { Show, Suspense } from 'solid-js';
+import { ConnectionsPage } from './connections/ConnectionsPage';
import { IntegrationsSection } from './Integrations';
-import { PipedreamIntegrationsSection } from './PipedreamIntegrations';
import { SettingsPage } from './primitives';
-/**
- * The agents sidebar's "Connections" page: MCP integrations only. Linking
- * personal accounts (Gmail, GitHub) lives on the Integrations settings tab
- * (see `ConnectedAccounts.tsx`), which keeps this page about what the agent
- * can reach.
- */
+/** Agent tool connections. Personal Gmail/GitHub accounts remain in Settings → Integrations. */
export function McpConnections() {
const pipedreamMcp = usePipedreamMcpFlag();
+ const { openSettings } = useSettingsState();
return (
- <SettingsPage
- title="Connections"
- description="Connect the tools your team already uses so Macro's agent can work in them."
+ <Show
+ when={pipedreamMcp()}
+ fallback={
+ <SettingsPage
+ title="Connections"
+ description="Connect the tools your team already uses so Macro's agent can work in them."
+ >
+ <Suspense>
+ <IntegrationsSection />
+ </Suspense>
+ </SettingsPage>
+ }
>
- <Suspense>
- <Show when={pipedreamMcp()} fallback={<IntegrationsSection />}>
- <PipedreamIntegrationsSection />
- </Show>
- </Suspense>
- </SettingsPage>
+ <ConnectionsPage onOpenMacroMcp={() => openSettings('Agent')} />
+ </Show>
);
}
diff --git a/apps/web/src/features/settings/MobileSettingsSheet.tsx b/apps/web/src/features/settings/MobileSettingsSheet.tsx
index f113b559cc..df45bce51e 100644
--- a/apps/web/src/features/settings/MobileSettingsSheet.tsx
+++ b/apps/web/src/features/settings/MobileSettingsSheet.tsx
@@ -30,11 +30,15 @@ export function MobileSettingsSheet(props: MobileSettingsSheetProps) {
let mainScrollTop = 0;
let scrollRef: HTMLDivElement | undefined;
let headingRef: HTMLHeadingElement | undefined;
+ // Legacy runtime links share the single Agents management navigation entry.
+ const navigationPage = () =>
+ props.page === 'Harness' ? 'Agents' : props.page;
const pageLabel = () =>
props.groups
.flatMap((group) => group.items)
- .find((item) => item.tab === props.page)?.label ??
+ .find((item) => item.tab === navigationPage())?.label ??
+ (props.page === 'Harness' ? 'Agents' : undefined) ??
props.page ??
'Settings';
@@ -203,7 +207,9 @@ export function MobileSettingsSheet(props: MobileSettingsSheetProps) {
>
<Show
when={props.groups.some((group) =>
- group.items.some((item) => item.tab === page)
+ group.items.some(
+ (item) => item.tab === navigationPage()
+ )
)}
fallback={
<div class="flex h-full flex-col items-center justify-center gap-4 px-8 text-center">
diff --git a/apps/web/src/features/settings/PipedreamIntegrations.tsx b/apps/web/src/features/settings/PipedreamIntegrations.tsx
deleted file mode 100644
index 20845b2065..0000000000
--- a/apps/web/src/features/settings/PipedreamIntegrations.tsx
+++ /dev/null
@@ -1,290 +0,0 @@
-import { PIPEDREAM_ICON_MAP } from '@core/component/AI/constant/mcpServers';
-import { toast } from '@core/component/Toast/Toast';
-import { PipedreamConnectorIcon } from '@core/pipedream/ConnectorIcon';
-import {
- createPipedreamCatalogConnect,
- createPipedreamCatalogSearch,
-} from '@core/pipedream/catalog';
-import {
- clearPendingConnectApp,
- pendingConnectApp,
-} from '@core/pipedream/pendingConnect';
-import PlugIcon from '@phosphor-icons/core/regular/plug.svg?component-solid';
-import XIcon from '@phosphor-icons/core/regular/x.svg?component-solid';
-import {
- connectPipedreamApp,
- useDeletePipedreamConnectionMutation,
- usePipedreamConnectionsQuery,
- useUpdatePipedreamConnectionMutation,
-} from '@queries/pipedream-connectors';
-import type {
- PipedreamCatalogEntryResponse,
- PipedreamConnectionResponse,
-} from '@service-cognition/client';
-import { Button, ToggleSwitch } from '@ui';
-import {
- createEffect,
- createMemo,
- createSignal,
- For,
- on,
- Show,
-} from 'solid-js';
-import { ConnectAction } from './integration-ui';
-import { IntegrationRow, SettingsCard, SettingsSection } from './primitives';
-
-/** A connected app: enable/disable for tool use, or disconnect. */
-function ServerRow(props: { server: PipedreamConnectionResponse }) {
- const updateMutation = useUpdatePipedreamConnectionMutation();
- const deleteMutation = useDeletePipedreamConnectionMutation();
- const [confirmDelete, setConfirmDelete] = createSignal(false);
-
- const handleToggleEnabled = () => {
- updateMutation.mutate(
- { app_slug: props.server.app_slug, enabled: !props.server.enabled },
- {
- onError: () => {
- toast.failure('Failed to update connector');
- },
- }
- );
- };
-
- const handleDelete = () => {
- deleteMutation.mutate(
- { app_slug: props.server.app_slug },
- {
- onSuccess: () => {
- toast.success('Connector removed');
- setConfirmDelete(false);
- },
- onError: () => {
- toast.failure('Failed to remove connector');
- setConfirmDelete(false);
- },
- }
- );
- };
-
- const Icon = () => PIPEDREAM_ICON_MAP.get(props.server.app_slug) ?? PlugIcon;
-
- return (
- <IntegrationRow
- icon={(() => {
- const C = Icon();
- return <C class="size-5" />;
- })()}
- title={props.server.server_name}
- description={props.server.app_slug}
- >
- <ToggleSwitch
- size="md"
- checked={props.server.enabled}
- disabled={updateMutation.isPending}
- onChange={handleToggleEnabled}
- label={props.server.enabled ? 'Enabled' : 'Disabled'}
- labelClass="inline-block w-14 text-left text-xs text-ink-muted whitespace-nowrap"
- />
-
- <Show
- when={!confirmDelete()}
- fallback={
- <div class="flex items-center gap-1">
- <Button
- variant="danger"
- size="sm"
- depth={3}
- disabled={deleteMutation.isPending}
- onClick={handleDelete}
- >
- {deleteMutation.isPending ? 'Removing...' : 'Confirm'}
- </Button>
- <Button
- variant="outline"
- size="sm"
- depth={3}
- onClick={() => setConfirmDelete(false)}
- >
- Cancel
- </Button>
- </div>
- }
- >
- <Button
- variant="outline"
- size="sm"
- depth={3}
- tooltip="Remove"
- onClick={() => setConfirmDelete(true)}
- >
- <XIcon class="size-4" />
- </Button>
- </Show>
- </IntegrationRow>
- );
-}
-
-/**
- * A connectable app from the catalog the user hasn't connected yet, shown
- * inline in the integrations list to make connecting a one-click affair.
- * Once connected, the app shows up as a regular {@link ServerRow} instead.
- */
-function CatalogRow(props: { entry: PipedreamCatalogEntryResponse }) {
- const { connect, busy } = createPipedreamCatalogConnect({
- entry: () => props.entry,
- onConnected: (entry) => toast.success(`${entry.display_name} connected`),
- });
-
- return (
- <IntegrationRow
- icon={
- <PipedreamConnectorIcon
- appSlug={props.entry.app_slug}
- iconUrl={props.entry.icon_url}
- />
- }
- title={props.entry.display_name}
- description={props.entry.description ?? props.entry.app_slug}
- >
- <ConnectAction
- label="Connect"
- onClick={() => void connect()}
- loading={busy()}
- />
- </IntegrationRow>
- );
-}
-
-/**
- * The "MCP integrations" section of the Connections/Integrations pages: apps the user has
- * connected, then a searchable catalog of every connectable app, ranked by
- * popularity — all connecting through Pipedream, the single connect path.
- */
-export function PipedreamIntegrationsSection() {
- const serversQuery = usePipedreamConnectionsQuery();
-
- const servers = () => serversQuery.data ?? [];
- const connectedSlugs = createMemo(
- () => new Set(servers().map((s) => s.app_slug))
- );
-
- // An agent reply's "Connect X" chip asks for one app to be connected and
- // opens this page; start that app's Connect flow as soon as the request is
- // seen, whether this section mounted for it or was already showing. An
- // effect because this drives an imperative flow (the hosted iframe), not
- // derived state.
- createEffect(
- on(pendingConnectApp, (requested) => {
- if (!requested) return;
- clearPendingConnectApp();
- void connectPipedreamApp({ appSlug: requested })
- .then((outcome) => {
- if (outcome === 'unsupported') {
- toast.failure('Connectors are not available on this deployment');
- }
- })
- .catch(() => toast.failure(`Failed to connect ${requested}`));
- })
- );
-
- const catalog = createPipedreamCatalogSearch(connectedSlugs);
- const catalogQuery = catalog.query;
- const browseResults = catalog.entries;
-
- return (
- <SettingsSection
- title="MCP integrations"
- description="Connect the tools your team already uses to give Macro's agent access to them."
- >
- <Show when={serversQuery.isError}>
- <SettingsCard>
- <div class="px-6 py-8 text-center text-sm text-ink-muted">
- Failed to load integrations.
- <Button
- variant="outline"
- size="sm"
- depth={3}
- onClick={() => serversQuery.refetch()}
- class="ml-2"
- >
- Retry
- </Button>
- </div>
- </SettingsCard>
- </Show>
-
- <Show when={!serversQuery.isError && servers().length > 0}>
- <SettingsCard>
- <For each={servers()}>
- {(server) => <ServerRow server={server} />}
- </For>
- </SettingsCard>
- </Show>
-
- <SettingsCard>
- <div class="px-4 py-3">
- <input
- type="search"
- class="settings-input w-full"
- placeholder="Search all connectors..."
- value={catalog.searchInput()}
- onInput={(e) => catalog.onSearchInput(e.currentTarget.value)}
- />
- </div>
-
- <Show when={catalogQuery.isError}>
- <div class="px-6 py-6 text-center text-sm text-ink-muted">
- Couldn't load the connector catalog.
- <Button
- variant="outline"
- size="sm"
- depth={3}
- onClick={() => catalogQuery.refetch()}
- class="ml-2"
- >
- Retry
- </Button>
- </div>
- </Show>
-
- <Show when={!catalogQuery.isError}>
- <For each={browseResults()}>
- {(entry) => <CatalogRow entry={entry} />}
- </For>
-
- <Show when={catalogQuery.isFetching && browseResults().length === 0}>
- <div class="px-6 py-6 text-center text-sm text-ink-muted">
- Loading connectors...
- </div>
- </Show>
-
- <Show
- when={
- !catalogQuery.isFetching &&
- browseResults().length === 0 &&
- catalog.search().trim()
- }
- >
- <div class="px-6 py-6 text-center text-sm text-ink-muted">
- No connectors found for "{catalog.search().trim()}".
- </div>
- </Show>
-
- <Show when={catalogQuery.hasNextPage}>
- <div class="px-4 py-3 text-center">
- <Button
- variant="outline"
- size="sm"
- depth={3}
- disabled={catalogQuery.isFetchingNextPage}
- onClick={() => void catalogQuery.fetchNextPage()}
- >
- {catalogQuery.isFetchingNextPage ? 'Loading...' : 'Load more'}
- </Button>
- </div>
- </Show>
- </Show>
- </SettingsCard>
- </SettingsSection>
- );
-}
diff --git a/apps/web/src/features/settings/HarnessPairingDialog.test.tsx b/apps/web/src/features/settings/RuntimePairingPage.test.tsx
similarity index 79%
rename from apps/web/src/features/settings/HarnessPairingDialog.test.tsx
rename to apps/web/src/features/settings/RuntimePairingPage.test.tsx
index 8a27a97308..ab04a2b17e 100644
--- a/apps/web/src/features/settings/HarnessPairingDialog.test.tsx
+++ b/apps/web/src/features/settings/RuntimePairingPage.test.tsx
@@ -10,7 +10,7 @@ import {
within,
} from '@solidjs/testing-library';
import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
-import { HarnessPairingDialog } from './HarnessPairingDialog';
+import { RuntimePairingPage } from './RuntimePairingPage';
const mocks = vi.hoisted(() => ({
pairing: {
@@ -53,7 +53,7 @@ vi.mock('@queries/harnesses/harnesses', () => ({
}));
vi.mock('@queries/team/teams', () => ({
- useCurrentTeamQuery: () => ({ data: mocks.currentTeam }),
+ useCurrentTeamQuery: () => ({ isSuccess: true, data: mocks.currentTeam }),
}));
vi.mock('@core/component/Toast/Toast', () => ({
@@ -75,17 +75,23 @@ beforeEach(() => {
mocks.currentTeam = { team: { id: 'team-1' } };
});
-describe('HarnessPairingDialog', () => {
+describe('RuntimePairingPage', () => {
it('looks up a typed code and shows the pairing request', () => {
- render(() => <HarnessPairingDialog onClose={() => {}} />);
+ render(() => <RuntimePairingPage onClose={() => {}} />);
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: 'New runtime' });
const codeInput = within(dialog).getByLabelText('Pairing code');
+ expect(codeInput).toHaveProperty('value', '');
+ expect(
+ screen.queryByRole('img', { name: /Example macrod terminal/ })
+ ).toBeNull();
fireEvent.input(codeInput, { target: { value: 'kx7m-4qhd' } });
expect(codeInput).toHaveProperty('value', 'KX7M-4QHD');
fireEvent.click(within(dialog).getByRole('button', { name: 'Look up' }));
-
+ expect(
+ screen.queryByRole('list', { name: 'Runtime setup steps' })
+ ).toBeNull();
expect(within(dialog).getByText('KX7M-4QHD')).toBeTruthy();
expect(
within(dialog).getByText(/Confirm this matches the code macrod printed/)
@@ -101,10 +107,10 @@ describe('HarnessPairingDialog', () => {
it('approves a private harness without a team id', async () => {
render(() => (
- <HarnessPairingDialog initialCode="KX7M-4QHD" onClose={() => {}} />
+ <RuntimePairingPage initialCode="KX7M-4QHD" onClose={() => {}} />
));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: 'New runtime' });
fireEvent.input(within(dialog).getByLabelText('Name'), {
target: { value: 'Home desktop' },
});
@@ -117,16 +123,16 @@ describe('HarnessPairingDialog', () => {
allowPermissionBypass: false,
teamId: undefined,
});
- expect(mocks.toastSuccess).toHaveBeenCalledWith('Harness connected');
+ expect(mocks.toastSuccess).toHaveBeenCalledWith('Runtime connected');
});
});
it('approves a team harness with the current team id', async () => {
render(() => (
- <HarnessPairingDialog initialCode="KX7M-4QHD" onClose={() => {}} />
+ <RuntimePairingPage initialCode="KX7M-4QHD" onClose={() => {}} />
));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: 'New runtime' });
fireEvent.click(within(dialog).getByLabelText('Team'));
fireEvent.click(within(dialog).getByRole('button', { name: 'Approve' }));
@@ -144,18 +150,16 @@ describe('HarnessPairingDialog', () => {
mocks.currentTeam = null;
render(() => (
- <HarnessPairingDialog initialCode="KX7M-4QHD" onClose={() => {}} />
+ <RuntimePairingPage initialCode="KX7M-4QHD" onClose={() => {}} />
));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: 'New runtime' });
expect(within(dialog).getByLabelText('Team')).toHaveProperty(
'disabled',
true
);
expect(
- within(dialog).getByText(
- 'Create or join a team before sharing harnesses.'
- )
+ within(dialog).getByText('Create or join a team before sharing runtimes.')
).toBeTruthy();
});
@@ -163,10 +167,10 @@ describe('HarnessPairingDialog', () => {
mocks.pairing.isError = true;
render(() => (
- <HarnessPairingDialog initialCode="KX7M-4QHD" onClose={() => {}} />
+ <RuntimePairingPage initialCode="KX7M-4QHD" onClose={() => {}} />
));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: 'New runtime' });
expect(
within(dialog).getByText(
'This pairing code is invalid, expired, or already claimed.'
@@ -182,16 +186,16 @@ describe('HarnessPairingDialog', () => {
it('shows the success phase after approving', async () => {
const onClose = vi.fn();
render(() => (
- <HarnessPairingDialog initialCode="KX7M-4QHD" onClose={onClose} />
+ <RuntimePairingPage initialCode="KX7M-4QHD" onClose={onClose} />
));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: 'New runtime' });
fireEvent.click(within(dialog).getByRole('button', { name: 'Approve' }));
await waitFor(() => {
expect(
within(dialog).getByText(
- 'Harness connected. macrod will finish pairing automatically.'
+ 'Runtime connected. macrod will finish pairing automatically.'
)
).toBeTruthy();
});
@@ -203,9 +207,9 @@ describe('HarnessPairingDialog', () => {
it('warns before opting a harness into permission bypass', async () => {
render(() => (
- <HarnessPairingDialog initialCode="KX7M-4QHD" onClose={() => {}} />
+ <RuntimePairingPage initialCode="KX7M-4QHD" onClose={() => {}} />
));
- const dialog = screen.getByRole('dialog');
+ const dialog = screen.getByRole('region', { name: 'New runtime' });
const toggle = within(dialog).getByRole('checkbox');
expect(toggle).toHaveProperty('checked', false);
fireEvent.click(toggle);
@@ -223,7 +227,7 @@ it('warns before opting a harness into permission bypass', async () => {
it('preselects daemon bypass consent and lets the approving user decline it', async () => {
mocks.pairing.data.requested_allow_permission_bypass = true;
render(() => (
- <HarnessPairingDialog initialCode="KX7M-4QHD" onClose={() => {}} />
+ <RuntimePairingPage initialCode="KX7M-4QHD" onClose={() => {}} />
));
const checkbox = screen.getByRole('checkbox', {
name: 'Allow bypassing permission requests',
@@ -242,7 +246,7 @@ it('preselects daemon bypass consent and lets the approving user decline it', as
it('prevents approval from overriding the daemon prompt-only choice', async () => {
mocks.pairing.data.requested_allow_permission_bypass = false;
render(() => (
- <HarnessPairingDialog initialCode="KX7M-4QHD" onClose={() => {}} />
+ <RuntimePairingPage initialCode="KX7M-4QHD" onClose={() => {}} />
));
const checkbox = screen.getByRole('checkbox', {
name: 'Allow bypassing permission requests',
diff --git a/apps/web/src/features/settings/HarnessPairingDialog.tsx b/apps/web/src/features/settings/RuntimePairingPage.tsx
similarity index 51%
rename from apps/web/src/features/settings/HarnessPairingDialog.tsx
rename to apps/web/src/features/settings/RuntimePairingPage.tsx
index 4484becaac..d33734ac19 100644
--- a/apps/web/src/features/settings/HarnessPairingDialog.tsx
+++ b/apps/web/src/features/settings/RuntimePairingPage.tsx
@@ -1,13 +1,15 @@
import { toast } from '@core/component/Toast/Toast';
import { ThrownResultError } from '@core/util/result';
+import ArrowLeftIcon from '@phosphor/arrow-left.svg';
import {
useApproveHarnessPairingMutation,
useHarnessPairingQuery,
} from '@queries/harnesses/harnesses';
import { useCurrentTeamQuery } from '@queries/team/teams';
-import { Button, Checkbox, Dialog, Panel } from '@ui';
+import { Button, Checkbox } from '@ui';
import { createEffect, createSignal, Match, Show, Switch } from 'solid-js';
-import { ChoiceRow } from './primitives';
+import { RuntimeSetupSteps } from './components/runtime-setup-steps';
+import { ChoiceRow, SettingsPage } from './primitives';
const PAIRING_ERROR_FALLBACK =
'This pairing code is invalid, expired, or already claimed.';
@@ -26,11 +28,11 @@ function expiresInMinutes(expiresAt: string): number {
}
/**
- * Dialog that walks the user through approving a macrod pairing request:
+ * Page that walks the user through approving a macrod pairing request:
* enter the printed code, review the request, and approve it as a private or
- * team harness.
+ * team runtime.
*/
-export function HarnessPairingDialog(props: {
+export function RuntimePairingPage(props: {
initialCode?: string;
onClose: () => void;
}) {
@@ -51,7 +53,8 @@ export function HarnessPairingDialog(props: {
const pairingQuery = useHarnessPairingQuery(committedCode);
const approveMutation = useApproveHarnessPairingMutation();
const currentTeamQuery = useCurrentTeamQuery();
- const currentTeamId = () => currentTeamQuery.data?.team.id;
+ const currentTeamId = () =>
+ currentTeamQuery.isSuccess ? currentTeamQuery.data?.team.id : undefined;
const canShareWithTeam = () => currentTeamId() !== undefined;
const pairingData = () =>
pairingQuery.isSuccess ? pairingQuery.data : undefined;
@@ -120,165 +123,169 @@ export function HarnessPairingDialog(props: {
teamId: share() === 'Team' ? currentTeamId() : undefined,
});
setApproved(true);
- toast.success('Harness connected');
+ toast.success('Runtime connected');
} catch (error) {
setApproveError(failureMessage(error, PAIRING_ERROR_FALLBACK));
}
};
return (
- <Dialog
- open
- onOpenChange={(open) =>
- !open && !approveMutation.isPending && props.onClose()
+ <SettingsPage
+ title={approved() ? 'Runtime connected' : 'New runtime'}
+ showTitleInSheet
+ description="Connect an agent running on your own machine."
+ actions={
+ <Button
+ variant="ghost"
+ size="sm"
+ disabled={approveMutation.isPending}
+ onClick={props.onClose}
+ >
+ <ArrowLeftIcon />
+ Back
+ </Button>
}
- position="center"
- visibleScrim
- class="w-[min(480px,calc(100vw-16px))]"
>
- <Panel depth={2} class="max-h-[88vh] rounded-xl text-ink">
- <Panel.Header class="px-5 py-3">
- <Dialog.Title class="text-sm font-semibold">
- {approved() ? 'Harness connected' : 'Connect a harness'}
- </Dialog.Title>
- </Panel.Header>
- <Panel.Body class="overflow-y-auto p-5">
- <Switch>
- <Match when={approved()}>
- <p class="text-sm leading-5 text-ink-muted">
- Harness connected. macrod will finish pairing automatically.
- </p>
- </Match>
+ <section
+ aria-label="New runtime"
+ class="@container rounded-xl border border-edge-muted bg-surface-2 p-6"
+ >
+ <Switch>
+ <Match when={approved()}>
+ <p class="text-sm leading-5 text-ink-muted">
+ Runtime connected. macrod will finish pairing automatically.
+ </p>
+ </Match>
- <Match when={errorMessage()}>
- {(message) => (
- <div class="flex flex-col gap-3">
- <p class="text-sm leading-5 text-negative">{message()}</p>
- <div>
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={tryAnotherCode}
- >
- Try another code
- </Button>
- </div>
+ <Match when={errorMessage()}>
+ {(message) => (
+ <div class="flex flex-col gap-3">
+ <p class="text-sm leading-5 text-negative">{message()}</p>
+ <div>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={tryAnotherCode}
+ >
+ Try another code
+ </Button>
</div>
- )}
- </Match>
+ </div>
+ )}
+ </Match>
- <Match when={pairingData()}>
- {(pairing) => (
- <div class="flex flex-col gap-4">
- <div class="flex flex-col gap-1.5">
- <div class="rounded-lg border border-edge-muted bg-ink/[0.025] px-3 py-3 text-center font-mono text-2xl tracking-[0.2em] text-ink">
- {pairing().code}
- </div>
- <p class="text-xs text-ink-muted">
- Confirm this matches the code macrod printed.
- </p>
+ <Match when={pairingData()}>
+ {(pairing) => (
+ <div class="flex flex-col gap-4">
+ <div class="flex flex-col gap-1.5">
+ <div class="rounded-lg border border-edge-muted bg-ink/[0.025] px-3 py-3 text-center font-mono text-2xl tracking-[0.2em] text-ink">
+ {pairing().code}
</div>
+ <p class="text-xs text-ink-muted">
+ Confirm this matches the code macrod printed.
+ </p>
+ </div>
- <div class="flex flex-col gap-0.5 text-xs text-ink-muted">
- <span>
- Requested name:{' '}
- <span class="text-ink">{pairing().requested_name}</span>
- </span>
- <Show when={pairing().host}>
- {(host) => (
- <span>
- Host: <span class="text-ink">{host()}</span>
- </span>
- )}
- </Show>
- <span>
- Expires in {expiresInMinutes(pairing().expires_at)}{' '}
- minutes
- </span>
- </div>
+ <div class="flex flex-col gap-0.5 text-xs text-ink-muted">
+ <span>
+ Requested name:{' '}
+ <span class="text-ink">{pairing().requested_name}</span>
+ </span>
+ <Show when={pairing().host}>
+ {(host) => (
+ <span>
+ Host: <span class="text-ink">{host()}</span>
+ </span>
+ )}
+ </Show>
+ <span>
+ Expires in {expiresInMinutes(pairing().expires_at)} minutes
+ </span>
+ </div>
- <label class="flex flex-col gap-1.5">
- <span class="text-xs font-medium text-ink">Name</span>
- <input
- class="settings-input w-full"
- value={name()}
- onInput={(event) => {
- setNameEdited(true);
- setName(event.currentTarget.value);
- }}
- />
- </label>
+ <label class="flex flex-col gap-1.5">
+ <span class="text-xs font-medium text-ink">Name</span>
+ <input
+ class="settings-input w-full"
+ value={name()}
+ onInput={(event) => {
+ setNameEdited(true);
+ setName(event.currentTarget.value);
+ }}
+ />
+ </label>
- <fieldset class="grid grid-cols-2 gap-2 mobile:grid-cols-1">
- <legend class="sr-only">Share</legend>
- <ChoiceRow
- name="harness-share"
- value="private"
- checked={share() === 'Private'}
- title="Private"
- description="Only you can run agents on this harness."
- onChange={() => {
- setShareEdited(true);
- setShare('Private');
- }}
- />
- <ChoiceRow
- name="harness-share"
- value="team"
- checked={share() === 'Team'}
- title="Team"
- description={
- canShareWithTeam()
- ? 'Your team can run agents on this harness.'
- : 'Create or join a team before sharing harnesses.'
- }
- disabled={!canShareWithTeam()}
- onChange={() => {
- setShareEdited(true);
- setShare('Team');
- }}
- />
- </fieldset>
- <div class="flex flex-col gap-2">
- <Checkbox
- class="flex items-center gap-3 text-sm"
- checked={allowPermissionBypass()}
- disabled={
- pairing().requested_allow_permission_bypass === false
- }
- onChange={(allowed) => {
- setPermissionBypassEdited(true);
- setAllowPermissionBypass(allowed);
- }}
- >
- <Checkbox.Control />
- <Checkbox.Label>
- Allow bypassing permission requests
- </Checkbox.Label>
- </Checkbox>
- <p class="text-xs text-ink-muted">
- {pairing().requested_allow_permission_bypass === false
- ? 'This daemon requires permission prompts. Change its setting and pair again to allow bypass.'
- : 'When off, every agent on this harness must ask for permission.'}
+ <fieldset class="grid grid-cols-1 gap-2 @min-[440px]:grid-cols-2">
+ <legend class="sr-only">Share</legend>
+ <ChoiceRow
+ name="harness-share"
+ value="private"
+ checked={share() === 'Private'}
+ title="Private"
+ description="Only you can run agents on this runtime."
+ onChange={() => {
+ setShareEdited(true);
+ setShare('Private');
+ }}
+ />
+ <ChoiceRow
+ name="harness-share"
+ value="team"
+ checked={share() === 'Team'}
+ title="Team"
+ description={
+ canShareWithTeam()
+ ? 'Your team can run agents on this runtime.'
+ : 'Create or join a team before sharing runtimes.'
+ }
+ disabled={!canShareWithTeam()}
+ onChange={() => {
+ setShareEdited(true);
+ setShare('Team');
+ }}
+ />
+ </fieldset>
+ <div class="flex flex-col gap-2">
+ <Checkbox
+ class="flex items-center gap-3 text-sm"
+ checked={allowPermissionBypass()}
+ disabled={
+ pairing().requested_allow_permission_bypass === false
+ }
+ onChange={(allowed) => {
+ setPermissionBypassEdited(true);
+ setAllowPermissionBypass(allowed);
+ }}
+ >
+ <Checkbox.Control />
+ <Checkbox.Label>
+ Allow bypassing permission requests
+ </Checkbox.Label>
+ </Checkbox>
+ <p class="text-xs text-ink-muted">
+ {pairing().requested_allow_permission_bypass === false
+ ? 'This daemon requires permission prompts. Change its setting and pair again to allow bypass.'
+ : 'When off, every agent on this runtime must ask for permission.'}
+ </p>
+ <Show when={allowPermissionBypass()}>
+ <p class="text-xs text-negative" role="alert">
+ Agents can run commands and edit files on this machine
+ without approval. Only enable this if you trust everyone
+ who can create agents on this runtime.
</p>
- <Show when={allowPermissionBypass()}>
- <p class="text-xs text-negative" role="alert">
- Agents can run commands and edit files on this machine
- without approval. Only enable this if you trust everyone
- who can create agents on this harness.
- </p>
- </Show>
- </div>
+ </Show>
</div>
- )}
- </Match>
+ </div>
+ )}
+ </Match>
- <Match when={committedCode()}>
- <p class="text-sm text-ink-muted">Looking up pairing code…</p>
- </Match>
+ <Match when={committedCode()}>
+ <p class="text-sm text-ink-muted">Looking up pairing code…</p>
+ </Match>
- <Match when>
+ <Match when>
+ <RuntimeSetupSteps>
<div class="flex flex-col gap-1.5">
<label
for="harness-pairing-code"
@@ -289,8 +296,8 @@ export function HarnessPairingDialog(props: {
<div class="flex min-w-0 items-center gap-2 rounded-lg border border-edge-muted bg-ink/[0.025] px-3 py-2">
<input
id="harness-pairing-code"
- autofocus
autocomplete="off"
+ aria-describedby="harness-pairing-code-help"
spellcheck={false}
class="min-w-0 flex-1 bg-transparent font-mono text-sm uppercase tracking-widest text-ink outline-none"
placeholder="KX7M-4QHD"
@@ -303,14 +310,18 @@ export function HarnessPairingDialog(props: {
}}
/>
</div>
- <p class="text-xs text-ink-extra-muted">
- Run macrod on your computer and enter the code it prints.
+ <p
+ id="harness-pairing-code-help"
+ class="text-xs text-ink-extra-muted"
+ >
+ Already configured? Press <kbd>p</kbd> in macrod to get a new
+ code.
</p>
</div>
- </Match>
- </Switch>
- </Panel.Body>
- <Panel.Footer class="justify-end gap-2 px-5 py-3">
+ </RuntimeSetupSteps>
+ </Match>
+ </Switch>
+ <div class="mt-6 flex justify-end gap-2 border-t border-edge-muted pt-4">
<Switch>
<Match when={approved()}>
<Button
@@ -382,8 +393,8 @@ export function HarnessPairingDialog(props: {
</Button>
</Match>
</Switch>
- </Panel.Footer>
- </Panel>
- </Dialog>
+ </div>
+ </section>
+ </SettingsPage>
);
}
diff --git a/apps/web/src/features/settings/Settings.tsx b/apps/web/src/features/settings/Settings.tsx
index ec58f87c08..dacd7bbba9 100644
--- a/apps/web/src/features/settings/Settings.tsx
+++ b/apps/web/src/features/settings/Settings.tsx
@@ -119,6 +119,8 @@ export function SettingsPanel(props: SettingsPanelProps) {
const logout = useLogout();
const variant = () => props.variant ?? 'split';
+ const activeNavigationTab = () =>
+ activeTabId() === 'Harness' ? 'Agents' : activeTabId();
// Responsive state, driven by the panel's own width (see breakpoints above).
const [panelWidth, setPanelWidth] = createSignal(Number.POSITIVE_INFINITY);
@@ -180,7 +182,7 @@ export function SettingsPanel(props: SettingsPanelProps) {
}
function getCurrentTabIndex() {
- return flatTabs().findIndex((tab) => tab.tab === activeTabId());
+ return flatTabs().findIndex((tab) => tab.tab === activeNavigationTab());
}
function handleNextTab() {
@@ -288,7 +290,7 @@ export function SettingsPanel(props: SettingsPanelProps) {
class="-ml-(--mobile-chrome-gutter) w-[100cqw] max-w-none flex-none"
contentClass="px-(--mobile-chrome-gutter)"
items={tabItems()}
- value={activeTabId()}
+ value={activeNavigationTab()}
onChange={handleTabChange}
/>
}
@@ -308,7 +310,7 @@ export function SettingsPanel(props: SettingsPanelProps) {
<div class="mx-2 shrink-0">
<TabsInsetDropdown
list={tabItems()}
- value={activeTabId()}
+ value={activeNavigationTab()}
onChange={handleTabChange}
/>
</div>
@@ -353,7 +355,7 @@ export function SettingsPanel(props: SettingsPanelProps) {
{(item) => (
<SideNav.Item
icon={item.icon}
- active={activeTabId() === item.tab}
+ active={activeNavigationTab() === item.tab}
onSelect={() => handleTabChange(item.tab)}
class="text-xs py-1.5"
>
@@ -399,7 +401,7 @@ export function SettingsPanel(props: SettingsPanelProps) {
{backToApp()}
<TabsInsetDropdown
list={tabItems()}
- value={activeTabId()}
+ value={activeNavigationTab()}
onChange={handleTabChange}
/>
<div class="flex-1" />
diff --git a/apps/web/src/features/settings/SettingsTabContent.tsx b/apps/web/src/features/settings/SettingsTabContent.tsx
index aaa7302628..344d92aca7 100644
--- a/apps/web/src/features/settings/SettingsTabContent.tsx
+++ b/apps/web/src/features/settings/SettingsTabContent.tsx
@@ -4,14 +4,13 @@ import { Show, Suspense } from 'solid-js';
import { Account } from './Account';
import { Admin } from './Admin';
import { Agent } from './Agent';
-import { Agents } from './Agents';
+import { AgentSettings } from './AgentSettings';
import { ApiKeys } from './ApiKeys';
import { Appearance } from './Appearance';
import { Billing } from './Billing';
import { Bots } from './Bots';
import { ConnectedAccounts } from './ConnectedAccounts';
import { Crm } from './Crm';
-import { Harness } from './Harness';
import { MobileApp } from './MobileApp';
import { Notifications } from './Notifications';
import { Shortcuts } from './Shortcuts';
@@ -68,10 +67,10 @@ export function SettingsTabContent(props: { tab: SettingsTab }) {
<Agent />
</Show>
<Show when={isCurrentTab('Agents')}>
- <Agents />
+ <AgentSettings />
</Show>
<Show when={isCurrentTab('Harness')}>
- <Harness />
+ <AgentSettings initialSection="runtimes" />
</Show>
<Show when={isCurrentTab('Bots')}>
<Bots />
diff --git a/apps/web/src/features/settings/SignatureEditor.css b/apps/web/src/features/settings/SignatureEditor.css
index d4c2b7dc2e..ef48255fd1 100644
--- a/apps/web/src/features/settings/SignatureEditor.css
+++ b/apps/web/src/features/settings/SignatureEditor.css
@@ -25,18 +25,15 @@
vertical-align: middle;
}
-/* The editor surface is always white with near-black text, regardless of app
- theme: the signature is sent as HTML email and recipients see it on white, so
- the editor previews exactly that — and pasted light-UI content (e.g. Gmail
- signatures with white text backgrounds) doesn't render as white boxes in dark
- mode. */
+/* Match the settings surface without changing the signature's saved HTML or
+ overriding explicit text/background colors in pasted content. */
.signature-editor .ql-container.ql-snow {
- background-color: white;
+ background-color: var(--color-surface);
}
.signature-editor .ql-editor {
min-height: 8rem;
- color: #1f1f1f;
+ color: var(--color-ink);
}
.signature-editor .ql-editor img {
@@ -52,7 +49,7 @@
position: absolute;
display: none;
box-sizing: border-box;
- box-shadow: 0 0 0 2px rgba(0 0 0 / 0.15);
+ box-shadow: 0 0 0 2px var(--color-edge-muted);
pointer-events: none;
z-index: 1;
}
@@ -66,8 +63,7 @@
touch-action: none;
pointer-events: auto;
}
-/* The visible pill bar (matches the doc block's bg-ink / ring-surface bar).
- Fixed colors, not ink/surface tokens: the editor surface is always white. */
+/* The visible pill bar matches the doc block's bg-ink / ring-surface bar. */
.signature-editor .ql-image-resizer-handle::before {
content: '';
position: absolute;
@@ -77,8 +73,8 @@
height: 50%;
min-height: 2rem;
transform: translateY(-50%);
- background-color: #1f1f1f;
- box-shadow: 0 0 0 2px white;
+ background-color: var(--color-ink);
+ box-shadow: 0 0 0 2px var(--color-surface);
border-radius: 9999px;
opacity: 0.5;
transition: all 200ms ease;
@@ -94,10 +90,8 @@
transform: translateY(-50%) scale(1.2);
}
-/* Fixed grey (not the theme's muted ink, which is light in dark mode and would
- vanish on the always-white surface). */
.signature-editor .ql-editor.ql-blank::before {
- color: #8a8a8a;
+ color: var(--color-ink-placeholder);
font-style: normal;
}
diff --git a/apps/web/src/features/settings/SignatureSection.tsx b/apps/web/src/features/settings/SignatureSection.tsx
index 320ab2be00..b632e5f069 100644
--- a/apps/web/src/features/settings/SignatureSection.tsx
+++ b/apps/web/src/features/settings/SignatureSection.tsx
@@ -2,6 +2,7 @@ import { toast } from '@core/component/Toast/Toast';
import { isMobile } from '@core/mobile/isMobile';
import { ThrownResultError } from '@core/util/result';
import SignatureIcon from '@phosphor-icons/core/regular/signature.svg?component-solid';
+import XIcon from '@phosphor-icons/core/regular/x.svg?component-solid';
import { useEmailSignature } from '@queries/email/link';
import { useUpdateEmailSettingsMutation } from '@queries/email/settings';
import { SIGNATURE_IMAGES_UNRESOLVED_CODE } from '@service-email/client';
@@ -77,7 +78,10 @@ function saveSignatureErrorMessage(error: Error): string {
* patches `email_settings` on save. The "replies & forwards" toggle patches
* immediately (the backend patch is partial, so it leaves the signature alone).
*/
-export function SignatureSection(props: { link: EmailLink }) {
+export function SignatureSection(props: {
+ link: EmailLink;
+ onClose: () => void;
+}) {
const signature = useEmailSignature(() => props.link.id);
// Draft lives in the module-level store (keyed by link id) so it survives the
// settings tab unmounting; `null` means "no unsaved edit".
@@ -160,6 +164,18 @@ export function SignatureSection(props: { link: EmailLink }) {
return (
<div class="flex flex-col gap-3 rounded-xl border border-edge-muted p-3">
+ <div class="flex items-center justify-between gap-3">
+ <h3 class="text-sm font-medium">Signature</h3>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ tooltip="Close signature editor"
+ aria-label="Close signature editor"
+ onClick={props.onClose}
+ >
+ <XIcon class="size-4" />
+ </Button>
+ </div>
{/* Editing (Quill) is desktop-only; on mobile the section still offers
the replies/forwards toggle and Remove, with a pointer to desktop. */}
<Show
diff --git a/apps/web/src/features/settings/codex/components/CodexConnection.test.tsx b/apps/web/src/features/settings/codex/components/CodexConnection.test.tsx
index 0afe46b28d..a84f7512fa 100644
--- a/apps/web/src/features/settings/codex/components/CodexConnection.test.tsx
+++ b/apps/web/src/features/settings/codex/components/CodexConnection.test.tsx
@@ -1,9 +1,12 @@
-import { fireEvent, render, screen } from '@solidjs/testing-library';
+import { fireEvent, render, screen, waitFor } from '@solidjs/testing-library';
import { createSignal } from 'solid-js';
import { describe, expect, it, vi } from 'vitest';
+import { chooseSelectOption } from '../../tests/select-helpers';
import { CodexConnection } from './CodexConnection';
-vi.mock('@ui', () => ({
+vi.mock('@ui', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('@ui')>()),
+ confirmDialog: vi.fn(async () => true),
Button: (
props: import('solid-js').JSX.ButtonHTMLAttributes<HTMLButtonElement>
) => <button {...props} />,
@@ -58,9 +61,6 @@ describe('Codex connection', () => {
environmentsError
/>
));
- fireEvent.change(screen.getByLabelText('Cloud environment'), {
- target: { value: '' },
- });
expect(screen.queryByLabelText('Branch')).toBeNull();
expect(screen.getByRole('alert').textContent).toBe(
'Could not load environments.'
@@ -88,9 +88,7 @@ describe('Codex connection', () => {
'Loading environments…'
);
expect(screen.queryByLabelText('Branch')).toBeNull();
- expect(
- screen.getByRole('option', { name: 'Choose an environment' })
- ).toBeTruthy();
+ expect(screen.getByText('Choose an environment')).toBeTruthy();
});
it('starts device sign-in without requesting a token', () => {
@@ -130,7 +128,7 @@ describe('Codex connection', () => {
).toBeNull();
}
);
- it('saves only the selected environment and always describes the main branch', () => {
+ it('saves only the selected environment and always describes the main branch', async () => {
const props = base();
render(() => (
<CodexConnection
@@ -161,9 +159,10 @@ describe('Codex connection', () => {
.hasAttribute('disabled')
).toBe(true);
expect(screen.queryByLabelText('Branch')).toBeNull();
- fireEvent.change(screen.getByLabelText('Cloud environment'), {
- target: { value: 'env-1' },
- });
+ chooseSelectOption(
+ screen.getByLabelText('Cloud environment'),
+ 'Example repo — example/repo'
+ );
expect(screen.queryByLabelText('Branch')).toBeNull();
expect(
screen.getByText(/New sessions always start from the main branch/)
@@ -175,7 +174,7 @@ describe('Codex connection', () => {
environmentId: 'env-1',
});
fireEvent.click(screen.getByRole('button', { name: 'Disconnect ChatGPT' }));
- expect(props.onDisconnect).toHaveBeenCalledOnce();
+ await waitFor(() => expect(props.onDisconnect).toHaveBeenCalledOnce());
});
it('keeps server errors visible and prevents duplicate pending actions', () => {
render(() => (
@@ -219,18 +218,19 @@ describe('Codex connection', () => {
));
const save = screen.getByRole('button', { name: 'Save Codex settings' });
expect(save.hasAttribute('disabled')).toBe(true);
- fireEvent.change(screen.getByLabelText('Cloud environment'), {
- target: { value: 'env-1' },
- });
+ chooseSelectOption(
+ screen.getByLabelText('Cloud environment'),
+ 'env-1 — example/repo'
+ );
expect(screen.getByRole('status').textContent).toContain('Unsaved changes');
expect(save.hasAttribute('disabled')).toBe(false);
fireEvent.click(save);
setError('Could not save Codex settings.');
expect(screen.getByRole('status').textContent).toContain('Unsaved changes');
expect(save.hasAttribute('disabled')).toBe(false);
- expect(
- (screen.getByLabelText('Cloud environment') as HTMLSelectElement).value
- ).toBe('env-1');
+ expect(screen.getByLabelText('Cloud environment').textContent).toBe(
+ 'env-1 — example/repo'
+ );
setError(undefined);
setConnection({ connected: true, environmentId: 'env-1' });
expect(screen.queryByRole('status')).toBeNull();
diff --git a/apps/web/src/features/settings/codex/components/CodexConnection.tsx b/apps/web/src/features/settings/codex/components/CodexConnection.tsx
index a2ed528c08..9f69e24ae4 100644
--- a/apps/web/src/features/settings/codex/components/CodexConnection.tsx
+++ b/apps/web/src/features/settings/codex/components/CodexConnection.tsx
@@ -1,7 +1,8 @@
import OpenAiIcon from '@core/component/AI/assets/openai.svg';
import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';
-import { Button } from '@ui';
-import { createSignal, For, Show } from 'solid-js';
+import { Button, confirmDialog } from '@ui';
+import { createSignal, Show } from 'solid-js';
+import { SettingsSelect } from '../../components/settings-select';
import { HarnessIcon } from '../../integration-ui';
import type { CodexConnectionDisplay, CodexLoginDisplay } from '../core/types';
@@ -35,16 +36,28 @@ export function CodexConnection(props: {
selectedEnvironment() !== (props.connection?.environmentId ?? '');
const connected = () => props.connection?.connected === true;
const loginPending = () => props.login?.status === 'pending';
+ const disconnect = async () => {
+ if (props.pending) return;
+ const confirmed = await confirmDialog({
+ title: 'Disconnect ChatGPT?',
+ body: 'Remove your ChatGPT connection from Macro? Existing Codex cloud sessions keep running. You can reconnect at any time.',
+ confirmLabel: 'Disconnect',
+ tone: 'danger',
+ });
+ if (!confirmed || props.pending) return;
+ setEnvironment(undefined);
+ props.onDisconnect();
+ };
return (
<section class="flex gap-4 px-6 py-5" aria-label="Codex connection">
<HarnessIcon>
<OpenAiIcon />
</HarnessIcon>
<div class="min-w-0 flex-1">
- <div class="flex items-center gap-2">
- <h2 class="text-sm font-medium text-ink">Codex</h2>
+ <div class="flex min-h-5 items-start justify-between gap-3">
+ <h2 class="min-w-0 text-sm/5 font-medium text-ink">Codex</h2>
<Show when={connected()}>
- <span class="rounded-full bg-success-bg px-2 py-0.5 text-[11px] font-medium text-success">
+ <span class="inline-flex h-5 shrink-0 items-center whitespace-nowrap rounded-md bg-success-bg px-2 text-[11px]/none font-medium text-success">
Connected
</span>
</Show>
@@ -142,38 +155,26 @@ export function CodexConnection(props: {
</p>
</Show>
<div class="mt-4 flex flex-col gap-3">
- <label
- class="flex flex-col gap-1.5 text-xs text-ink"
- for="codex-environment"
- >
- Cloud environment
- <select
- id="codex-environment"
- class="settings-input w-full max-w-sm"
+ <div class="flex w-full max-w-60 flex-col gap-1.5">
+ <span class="text-xs font-medium text-ink">
+ Cloud environment
+ </span>
+ <SettingsSelect
+ label="Cloud environment"
+ placeholder="Choose an environment"
+ options={props.environments.map((item) => ({
+ id: item.id,
+ name: `${item.label ?? item.id}${
+ item.repositories.length
+ ? ` — ${item.repositories.map((repo) => repo.fullName).join(', ')}`
+ : ''
+ }`,
+ }))}
value={selectedEnvironment()}
disabled={props.environmentsLoading || props.pending}
- onChange={(event) => {
- setEnvironment(event.currentTarget.value);
- }}
- >
- <option value="" disabled selected={!selectedEnvironment()}>
- Choose an environment
- </option>
- <For each={props.environments}>
- {(item) => (
- <option
- value={item.id}
- selected={selectedEnvironment() === item.id}
- >
- {item.label ?? item.id}
- {item.repositories.length
- ? ` — ${item.repositories.map((repo) => repo.fullName).join(', ')}`
- : ''}
- </option>
- )}
- </For>
- </select>
- </label>
+ onChange={setEnvironment}
+ />
+ </div>
<p class="text-xs text-ink-extra-muted">
Choose and save an environment before using @codex. New sessions
always start from the main branch.
@@ -267,10 +268,7 @@ export function CodexConnection(props: {
class="shrink-0"
aria-label="Disconnect ChatGPT"
disabled={props.pending}
- onClick={() => {
- setEnvironment(undefined);
- props.onDisconnect();
- }}
+ onClick={() => void disconnect()}
>
Disconnect
</Button>
diff --git a/apps/web/src/features/settings/components/agent-management-navigation.tsx b/apps/web/src/features/settings/components/agent-management-navigation.tsx
new file mode 100644
index 0000000000..a9f6ec59f6
--- /dev/null
+++ b/apps/web/src/features/settings/components/agent-management-navigation.tsx
@@ -0,0 +1,34 @@
+import HardDrivesIcon from '@phosphor/hard-drives.svg';
+import SparkleIcon from '@phosphor/sparkle.svg';
+
+export type AgentManagementSection = 'agents' | 'runtimes';
+
+/** Section navigation shared by settings and the Agents workspace. */
+export function AgentManagementNavigation(props: {
+ section: AgentManagementSection;
+ onChange: (section: AgentManagementSection) => void;
+}) {
+ return (
+ <nav
+ aria-label="Agent management"
+ class="flex gap-1 border-b border-edge-muted"
+ >
+ <button
+ type="button"
+ aria-current={props.section === 'agents' ? 'page' : undefined}
+ onClick={() => props.onChange('agents')}
+ class="flex items-center gap-2 border-b-2 border-transparent px-4 py-3 text-sm text-ink-muted aria-[current=page]:border-accent aria-[current=page]:text-ink hover:text-ink focus-visible:outline-accent"
+ >
+ <SparkleIcon class="size-4" /> Agents
+ </button>
+ <button
+ type="button"
+ aria-current={props.section === 'runtimes' ? 'page' : undefined}
+ onClick={() => props.onChange('runtimes')}
+ class="flex items-center gap-2 border-b-2 border-transparent px-4 py-3 text-sm text-ink-muted aria-[current=page]:border-accent aria-[current=page]:text-ink hover:text-ink focus-visible:outline-accent"
+ >
+ <HardDrivesIcon class="size-4" /> Runtimes
+ </button>
+ </nav>
+ );
+}
diff --git a/apps/web/src/features/settings/components/agent-settings-description.tsx b/apps/web/src/features/settings/components/agent-settings-description.tsx
new file mode 100644
index 0000000000..b90ed223c7
--- /dev/null
+++ b/apps/web/src/features/settings/components/agent-settings-description.tsx
@@ -0,0 +1,16 @@
+/** Shared explanation of agents and runtimes, kept as plain header copy. */
+export function AgentSettingsDescription() {
+ return (
+ <>
+ <span class="block leading-relaxed">
+ Agents let you customize your Macro AI experience by combining a unique
+ name, specific instructions, default model, and harness.
+ </span>
+ <span class="mt-2 block leading-relaxed">
+ Runtimes are the harnesses that power agents in macro, whether our
+ native, fast, Macro AI harness, or coding harnesses like Cursor or your
+ own Claude Code.
+ </span>
+ </>
+ );
+}
diff --git a/apps/web/src/features/settings/components/bring-your-own-agent.css b/apps/web/src/features/settings/components/bring-your-own-agent.css
new file mode 100644
index 0000000000..3dc18e707d
--- /dev/null
+++ b/apps/web/src/features/settings/components/bring-your-own-agent.css
@@ -0,0 +1,23 @@
+.byoa-word {
+ display: inline-grid;
+ overflow: hidden;
+ vertical-align: bottom;
+}
+
+.byoa-word > span {
+ grid-area: 1 / 1;
+ opacity: 0;
+ animation: byoa-word-cycle 11s infinite;
+ animation-delay: calc(var(--word-index) * 2.75s);
+}
+
+@keyframes byoa-word-cycle {
+ 0% { opacity: 0; transform: translateY(55%); }
+ 3%, 21% { opacity: 1; transform: translateY(0); }
+ 25%, 100% { opacity: 0; transform: translateY(-55%); }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .byoa-word > span { animation: none; }
+ .byoa-word > span:first-child { opacity: 1; }
+}
diff --git a/apps/web/src/features/settings/components/bring-your-own-agent.tsx b/apps/web/src/features/settings/components/bring-your-own-agent.tsx
new file mode 100644
index 0000000000..4820fe3262
--- /dev/null
+++ b/apps/web/src/features/settings/components/bring-your-own-agent.tsx
@@ -0,0 +1,55 @@
+import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';
+import PlusIcon from '@phosphor/plus.svg';
+import TerminalIcon from '@phosphor/terminal-window.svg';
+import { Button } from '@ui';
+import { For } from 'solid-js';
+import './bring-your-own-agent.css';
+
+const AGENTS = ['Claude Code', 'OpenCode', 'OpenClaw', 'Hermes'];
+
+/** A quiet, CSS-only word rotation; reduced motion shows a static invitation. */
+export function BringYourOwnAgent(props: { onAddRuntime: () => void }) {
+ return (
+ <section class="byoa-card relative overflow-hidden rounded-xl border border-edge-muted bg-surface-2 p-6">
+ <div class="mb-5 flex items-center gap-2 text-xs font-medium text-ink-muted">
+ <TerminalIcon class="size-4" />
+ Bring your own agent
+ </div>
+ <h2 class="text-xl font-medium tracking-tight text-ink">
+ <span class="sr-only">Bring your agent to Macro</span>
+ <span
+ aria-hidden="true"
+ class="flex flex-wrap items-baseline gap-x-1.5"
+ >
+ Bring
+ <span class="byoa-word text-center text-accent">
+ <For each={AGENTS}>
+ {(agent, index) => (
+ <span style={{ '--word-index': index() }}>{agent}</span>
+ )}
+ </For>
+ </span>
+ to Macro.
+ </span>
+ </h2>
+ <p class="mt-3 max-w-lg text-sm leading-relaxed text-ink-muted">
+ Your agent, on your machine. Connect a runtime with macrod, then give
+ your agent instructions and a place in your workspace.
+ </p>
+ <div class="mt-5 flex flex-wrap items-center gap-3">
+ <Button variant="outline" size="sm" onClick={props.onAddRuntime}>
+ <PlusIcon />
+ New runtime
+ </Button>
+ <a
+ href="https://docs.macro.com/AI/bring-your-own"
+ target="_blank"
+ rel="noopener noreferrer"
+ class="inline-flex items-center gap-1 text-xs text-ink-muted hover:text-ink focus-visible:outline-accent"
+ >
+ Setup guide <ArrowUpRightIcon class="size-3" />
+ </a>
+ </div>
+ </section>
+ );
+}
diff --git a/apps/web/src/features/settings/components/instructions-editor.tsx b/apps/web/src/features/settings/components/instructions-editor.tsx
new file mode 100644
index 0000000000..d47944c171
--- /dev/null
+++ b/apps/web/src/features/settings/components/instructions-editor.tsx
@@ -0,0 +1,85 @@
+import { buildConfig } from '@core/component/LexicalMarkdown/builder/MarkdownConfigBuilder';
+import { MarkdownShell } from '@core/component/LexicalMarkdown/builder/MarkdownShell';
+import { createEffect, on, untrack } from 'solid-js';
+
+/** The app's Markdown editor, with string persistence owned by the agent draft. */
+export function AgentInstructionsEditor(props: {
+ markdown: string;
+ onChange: (markdown: string) => void;
+ disabled?: boolean;
+ placeholder?: string;
+ class?: string;
+}) {
+ const initialMarkdown = untrack(() => props.markdown);
+ let connected = false;
+ let applyingMarkdown = false;
+ let appliedMarkdown = initialMarkdown;
+ let renderedMarkdown = '';
+ let editable: HTMLDivElement | undefined;
+ const config = buildConfig('markdown')
+ .namespace('agent-instructions')
+ .withHistory()
+ .withCode()
+ .withMentions({ showOpenTabs: true, disableMentionTracking: true })
+ .withEmojis()
+ .withLinks({ floatingMenu: true })
+ .withFloatingFormatMenu()
+ .onChange((markdown) => {
+ if (!connected || applyingMarkdown || markdown === renderedMarkdown)
+ return;
+ renderedMarkdown = markdown;
+ // Use the shared editor's Markdown format so mention identities and
+ // other rich content survive saving and reopening the instructions.
+ appliedMarkdown = markdown;
+ props.onChange(appliedMarkdown);
+ });
+
+ const applyMarkdown = (markdown: string) => {
+ if (!connected || markdown === appliedMarkdown) return;
+ appliedMarkdown = markdown;
+ applyingMarkdown = true;
+ try {
+ config.controls.setMarkdown(markdown);
+ renderedMarkdown = config.controls.getMarkdown();
+ } finally {
+ applyingMarkdown = false;
+ }
+ };
+ createEffect(on(() => props.markdown, applyMarkdown));
+ createEffect(
+ on(
+ () => !!props.disabled,
+ (disabled) => editable?.setAttribute('aria-disabled', String(disabled))
+ )
+ );
+
+ return (
+ <div class={`portal-scope relative ${props.class ?? ''}`}>
+ <MarkdownShell
+ config={config}
+ initialValue={initialMarkdown}
+ disabled={props.disabled}
+ placeholder={props.placeholder}
+ portalScope="local"
+ class="min-h-40 text-sm leading-6 [&_[data-markdown-editable]]:min-h-full [&_[data-markdown-editable]]:outline-none"
+ refFn={(element) => {
+ editable = element;
+ element.setAttribute('role', 'textbox');
+ element.setAttribute('aria-label', 'Instructions');
+ element.setAttribute('aria-multiline', 'true');
+ element.setAttribute('aria-disabled', String(!!props.disabled));
+ }}
+ onConnect={() => {
+ // Importing Markdown can normalize whitespace or list markers. Keep
+ // the saved string untouched until the person actually edits it.
+ // Empty initialization is deferred, so flush it before recording the
+ // baseline; otherwise its first paragraph looks like a user edit.
+ config.controls.getLexical().read(() => {});
+ renderedMarkdown = config.controls.getMarkdown();
+ connected = true;
+ applyMarkdown(untrack(() => props.markdown));
+ }}
+ />
+ </div>
+ );
+}
diff --git a/apps/web/src/features/settings/components/runtime-setup-steps.tsx b/apps/web/src/features/settings/components/runtime-setup-steps.tsx
new file mode 100644
index 0000000000..7ad8c1c595
--- /dev/null
+++ b/apps/web/src/features/settings/components/runtime-setup-steps.tsx
@@ -0,0 +1,69 @@
+import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';
+import type { JSX } from 'solid-js';
+
+function SetupStep(props: {
+ number: number;
+ title: string;
+ children: JSX.Element;
+}) {
+ return (
+ <li class="relative grid grid-cols-[1.75rem_minmax(0,1fr)] gap-3 pb-7 last:pb-0 before:absolute before:top-9 before:bottom-2 before:left-[13px] before:w-px before:bg-edge-muted last:before:hidden">
+ <span
+ aria-hidden="true"
+ class="flex size-7 items-center justify-center rounded-full border border-edge-muted text-xs font-medium text-ink-muted"
+ >
+ {props.number}
+ </span>
+ <div class="min-w-0 pt-0.5">
+ <h2 class="text-sm font-medium text-ink">{props.title}</h2>
+ <div class="mt-2 flex flex-col gap-3 text-sm leading-relaxed text-ink-muted">
+ {props.children}
+ </div>
+ </div>
+ </li>
+ );
+}
+
+/** Installation instructions surrounding the live pairing-code form. */
+export function RuntimeSetupSteps(props: { children: JSX.Element }) {
+ return (
+ <ol aria-label="Runtime setup steps" class="list-none">
+ <SetupStep number={1} title="Install macrod">
+ <p>Download the macrod archive for your computer, then extract it.</p>
+ <a
+ href="https://github.com/macro-inc/macro/releases"
+ target="_blank"
+ rel="noopener noreferrer"
+ class="inline-flex w-fit items-center gap-1.5 rounded-lg border border-edge-muted px-3 py-2 text-xs font-medium text-ink hover:bg-ink/5 focus-visible:outline-accent"
+ >
+ Download macrod{' '}
+ <ArrowUpRightIcon aria-hidden="true" class="size-3.5" />
+ </a>
+ </SetupStep>
+ <SetupStep number={2} title="Run macrod">
+ <p>Open a terminal in the extracted folder and run:</p>
+ <div class="rounded-lg border border-edge-muted bg-ink/[0.025] px-3 py-2 font-mono text-sm text-ink">
+ <span
+ aria-hidden="true"
+ class="mr-2 select-none text-ink-extra-muted"
+ >
+ $
+ </span>
+ <code>./macrod</code>
+ </div>
+ <p>
+ Choose your agent, workspace, and access in Quickstart, then select{' '}
+ <span class="font-medium text-ink">Create and pair</span>. Keep macrod
+ running.
+ </p>
+ </SetupStep>
+ <SetupStep number={3} title="Enter your pairing code">
+ <p>
+ Enter the device code from your terminal to review and connect this
+ runtime.
+ </p>
+ {props.children}
+ </SetupStep>
+ </ol>
+ );
+}
diff --git a/apps/web/src/features/settings/components/settings-select.tsx b/apps/web/src/features/settings/components/settings-select.tsx
new file mode 100644
index 0000000000..19c953ab58
--- /dev/null
+++ b/apps/web/src/features/settings/components/settings-select.tsx
@@ -0,0 +1,38 @@
+import { Select } from '@ui';
+
+type SettingsOption = { id: string; name: string };
+
+/** A settings field using the app's accessible, styled select menu. */
+export function SettingsSelect(props: {
+ label: string;
+ options: SettingsOption[];
+ value?: string | null;
+ onChange: (id: string) => void;
+ disabled?: boolean;
+ placeholder?: string;
+ class?: string;
+}) {
+ return (
+ <Select<SettingsOption>
+ class={props.class ?? 'min-w-0 w-full'}
+ options={props.options}
+ optionValue="id"
+ optionTextValue="name"
+ value={props.options.find((option) => option.id === props.value) ?? null}
+ onChange={(option) => option && props.onChange(option.id)}
+ disabled={props.disabled}
+ placeholder={props.placeholder}
+ disallowEmptySelection
+ >
+ <Select.Trigger aria-label={props.label} class="settings-input w-full">
+ <Select.Value<SettingsOption>>
+ {(state) => state.selectedOption().name}
+ </Select.Value>
+ <Select.Icon />
+ </Select.Trigger>
+ <Select.Content class="max-w-[calc(100vw-1rem)]" portalScope="local">
+ <Select.Listbox />
+ </Select.Content>
+ </Select>
+ );
+}
diff --git a/apps/web/src/features/settings/connections/ConnectedView.tsx b/apps/web/src/features/settings/connections/ConnectedView.tsx
new file mode 100644
index 0000000000..7b7eda849e
--- /dev/null
+++ b/apps/web/src/features/settings/connections/ConnectedView.tsx
@@ -0,0 +1,121 @@
+import { DEBUG_SETTING_KEYS, useDebugSetting } from '@app/lib/debugSettings';
+import CaretRightIcon from '@phosphor/caret-right.svg';
+import { Button } from '@ui';
+import { For, Show } from 'solid-js';
+import { LeftoverRow } from './leftover-row';
+import type { ConnectionsModel } from './model';
+import { isConnectionsEmpty } from './model';
+import { IntegrationRow, SettingsCard, SettingsSection } from './primitives';
+import { availableStarters, providerIcon } from './provider-meta';
+import { useConnectionsView } from './view-state';
+
+export function ConnectedView(props: { model: ConnectionsModel }) {
+ const view = useConnectionsView();
+ const forceEmpty = useDebugSetting(DEBUG_SETTING_KEYS.FORCE_EMPTY_STATES);
+ const pipedreamLeftovers = () =>
+ props.model.leftovers.filter((row) => row.kind === 'pipedream');
+ const customMcps = () =>
+ props.model.leftovers.filter((row) => row.kind === 'native-mcp');
+ const showConnectors = () =>
+ props.model.providers.length > 0 || pipedreamLeftovers().length > 0;
+ return (
+ <Show
+ when={!forceEmpty() && !isConnectionsEmpty(props.model)}
+ fallback={<EmptyConnected />}
+ >
+ <Show when={showConnectors()}>
+ <SettingsSection>
+ <SettingsCard>
+ <For each={props.model.providers}>
+ {(provider) => (
+ <button
+ type="button"
+ class="w-full text-left outline-none hover:bg-ink/4 focus-visible:bg-ink/6"
+ onClick={() => view.openProvider(provider.id)}
+ >
+ <IntegrationRow
+ icon={providerIcon(provider.id)}
+ title={provider.name}
+ description={
+ <span class="ph-no-capture">{provider.summary}</span>
+ }
+ facts={provider.accounts}
+ >
+ <CaretRightIcon class="size-4 text-ink-extra-muted" />
+ </IntegrationRow>
+ </button>
+ )}
+ </For>
+ <For each={pipedreamLeftovers()}>
+ {(leftover) => <LeftoverRow leftover={leftover} />}
+ </For>
+ </SettingsCard>
+ </SettingsSection>
+ </Show>
+
+ <Show when={customMcps().length > 0}>
+ <SettingsSection
+ title="Custom MCP"
+ description="Servers you added by URL."
+ >
+ <SettingsCard>
+ <For each={customMcps()}>
+ {(leftover) => <LeftoverRow leftover={leftover} />}
+ </For>
+ </SettingsCard>
+ </SettingsSection>
+ </Show>
+
+ <Button
+ type="button"
+ variant="outline"
+ depth={3}
+ class="w-full justify-between"
+ onClick={view.showDiscover}
+ >
+ Add a connection
+ <CaretRightIcon class="size-4 text-ink-extra-muted" />
+ </Button>
+ </Show>
+ );
+}
+
+function EmptyConnected() {
+ const view = useConnectionsView();
+ return (
+ <>
+ <SettingsSection title="Start with a connection">
+ <SettingsCard>
+ <For each={availableStarters()}>
+ {(item) => (
+ <button
+ type="button"
+ class="w-full text-left outline-none hover:bg-ink/4 focus-visible:bg-ink/6"
+ onClick={() => view.openProvider(item.id)}
+ >
+ <IntegrationRow
+ icon={providerIcon(item.id)}
+ title={item.name}
+ description={item.note}
+ >
+ <CaretRightIcon class="size-4 text-ink-extra-muted" />
+ </IntegrationRow>
+ </button>
+ )}
+ </For>
+ </SettingsCard>
+ </SettingsSection>
+
+ <Button
+ type="button"
+ variant="outline"
+ depth={3}
+ class="w-full justify-between"
+ onClick={view.showDiscover}
+ >
+ Browse all Connections
+ <CaretRightIcon class="size-4 text-ink-extra-muted" />
+ </Button>
+ </>
+ );
+}
diff --git a/apps/web/src/features/settings/connections/ConnectionsPage.tsx b/apps/web/src/features/settings/connections/ConnectionsPage.tsx
new file mode 100644
index 0000000000..bab8ac2e1a
--- /dev/null
+++ b/apps/web/src/features/settings/connections/ConnectionsPage.tsx
@@ -0,0 +1,130 @@
+import { TabsInset } from '@core/component/TabsInset';
+import { toast } from '@core/component/Toast/Toast';
+import {
+ clearPendingConnectApp,
+ pendingConnectApp,
+} from '@core/pipedream/pendingConnect';
+import { connectPipedreamApp } from '@queries/pipedream-connectors';
+import { Button } from '@ui';
+import { createEffect, on, Show } from 'solid-js';
+import { ConnectedView } from './ConnectedView';
+import { DiscoverView } from './DiscoverView';
+import { PipedreamAiProvider } from './PipedreamAiProvider';
+import { SettingsPage } from './primitives';
+import { useConnectionsModel } from './use-connections-model';
+import { ConnectionsViewProvider, useConnectionsView } from './view-state';
+
+function MacroMcpSignpost(props: { onOpen: () => void }) {
+ return (
+ <p class="text-xs text-ink-muted text-balance">
+ Looking to use Macro in another app?{' '}
+ <button
+ type="button"
+ class="text-link outline-none hover:text-link-hover hover:underline focus-visible:underline"
+ onClick={props.onOpen}
+ >
+ Macro MCP
+ </button>
+ </p>
+ );
+}
+
+export function ConnectionsPage(props: { onOpenMacroMcp: () => void }) {
+ return (
+ <ConnectionsViewProvider>
+ <ConnectionsContent onOpenMacroMcp={props.onOpenMacroMcp} />
+ </ConnectionsViewProvider>
+ );
+}
+
+function ConnectionsContent(props: { onOpenMacroMcp: () => void }) {
+ const { model, ready, error, partialError, retry } = useConnectionsModel();
+ const view = useConnectionsView();
+ // Agent replies can request a connection while this page is already mounted.
+ createEffect(
+ on(pendingConnectApp, (requested) => {
+ if (!requested) return;
+ clearPendingConnectApp();
+ void connectPipedreamApp({ appSlug: requested })
+ .then((outcome) => {
+ if (outcome === 'unsupported')
+ toast.failure('Connectors are not available on this deployment');
+ })
+ .catch(() => toast.failure(`Failed to connect ${requested}`));
+ })
+ );
+ const description =
+ "Connect the tools your team already uses so Macro's agent can work in them.";
+
+ return (
+ <Show
+ when={!error()}
+ fallback={
+ <SettingsPage
+ title="Connections"
+ description={description}
+ onBack={view.provider() ? view.closeProvider : undefined}
+ >
+ <div class="flex items-center gap-3 text-sm text-ink-muted">
+ Couldn't load Connections.
+ <Button variant="outline" size="sm" depth={3} onClick={retry}>
+ Retry
+ </Button>
+ </div>
+ </SettingsPage>
+ }
+ >
+ <Show
+ when={ready() && view.provider()}
+ keyed
+ fallback={
+ <SettingsPage
+ title="Connections"
+ description={description}
+ signpost={<MacroMcpSignpost onOpen={props.onOpenMacroMcp} />}
+ >
+ <TabsInset
+ fullWidth
+ list={[
+ { value: 'connected', label: 'Connected' },
+ { value: 'discover', label: 'Discover' },
+ ]}
+ value={view.mode()}
+ onChange={(value) =>
+ value === 'discover' ? view.showDiscover() : view.showOverview()
+ }
+ />
+ <Show when={partialError()}>
+ <div
+ role="status"
+ class="flex items-center gap-3 text-sm text-ink-muted"
+ >
+ Some connections couldn't be loaded.
+ <Button variant="outline" size="sm" depth={3} onClick={retry}>
+ Retry
+ </Button>
+ </div>
+ </Show>
+ <Show
+ when={ready()}
+ fallback={
+ <p class="text-sm text-ink-muted">Loading Connections…</p>
+ }
+ >
+ <Show
+ when={view.mode() === 'discover'}
+ fallback={<ConnectedView model={model()} />}
+ >
+ <DiscoverView model={model()} />
+ </Show>
+ </Show>
+ </SettingsPage>
+ }
+ >
+ {(provider) => (
+ <PipedreamAiProvider model={model()} provider={provider} />
+ )}
+ </Show>
+ </Show>
+ );
+}
diff --git a/apps/web/src/features/settings/connections/DiscoverView.tsx b/apps/web/src/features/settings/connections/DiscoverView.tsx
new file mode 100644
index 0000000000..54d756a319
--- /dev/null
+++ b/apps/web/src/features/settings/connections/DiscoverView.tsx
@@ -0,0 +1,270 @@
+import { toast } from '@core/component/Toast/Toast';
+import { PipedreamConnectorIcon } from '@core/pipedream/ConnectorIcon';
+import {
+ createPipedreamCatalogConnect,
+ createPipedreamCatalogSearch,
+} from '@core/pipedream/catalog';
+import CaretRightIcon from '@phosphor/caret-right.svg';
+import CheckIcon from '@phosphor/check.svg';
+import PlusIcon from '@phosphor/plus.svg';
+import SpinnerIcon from '@phosphor/spinner-gap.svg';
+import XIcon from '@phosphor/x.svg';
+import type { PipedreamCatalogEntryResponse } from '@service-cognition/client';
+import { Button } from '@ui';
+import { createMemo, createSignal, For, Show } from 'solid-js';
+import { AddCustomMcpDialog } from './add-custom-mcp-dialog';
+import { ConnectAction } from './integration-ui';
+import type { ConnectionsModel } from './model';
+import { IntegrationRow, SettingsCard, SettingsSection } from './primitives';
+import {
+ availableStarters,
+ PIPEDREAM_BROWSE_HIDDEN_SLUGS,
+ providerIcon,
+} from './provider-meta';
+import { useConnectionsView } from './view-state';
+
+export function DiscoverView(props: { model: ConnectionsModel }) {
+ const view = useConnectionsView();
+ const alreadyHave = createMemo(() => {
+ const slugs = new Set<string>();
+ for (const row of props.model.capabilities) {
+ if (row.status !== 'not-connected') slugs.add(row.provider);
+ }
+ for (const leftover of props.model.leftovers) {
+ if (leftover.kind === 'pipedream') slugs.add(leftover.appSlug);
+ }
+ return slugs;
+ });
+ const catalog = createPipedreamCatalogSearch(
+ () => PIPEDREAM_BROWSE_HIDDEN_SLUGS
+ );
+ const [addingCustom, setAddingCustom] = createSignal(false);
+
+ const featured = createMemo(() => {
+ const query = catalog.searchInput().trim().toLowerCase();
+ return availableStarters().filter((item) => {
+ const haystack = `${item.name} ${item.note}`.toLowerCase();
+ return !query || haystack.includes(query);
+ });
+ });
+
+ const rest = createMemo(() => {
+ const query = catalog.search().trim().toLowerCase();
+ return catalog.entries().filter((entry) => {
+ if (!query) return true;
+ return `${entry.display_name} ${entry.description ?? ''} ${entry.app_slug}`
+ .toLowerCase()
+ .includes(query);
+ });
+ });
+
+ return (
+ <div class="flex flex-col gap-10">
+ <label class="relative block">
+ <span class="sr-only">Search Connections</span>
+ <input
+ type="search"
+ value={catalog.searchInput()}
+ onInput={(event) => catalog.onSearchInput(event.currentTarget.value)}
+ placeholder="Search Connections"
+ class="settings-input h-11 w-full pr-10 [&::-webkit-search-cancel-button]:hidden"
+ />
+ <Show when={catalog.searchInput()}>
+ <button
+ type="button"
+ aria-label="Clear search"
+ class="absolute top-1/2 right-2 flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-ink-muted outline-none hover:bg-ink/4 hover:text-ink focus-visible:bg-ink/6"
+ onPointerDown={(event) => event.preventDefault()}
+ onClick={() => catalog.onSearchInput('')}
+ >
+ <XIcon class="size-4" />
+ </button>
+ </Show>
+ </label>
+
+ <SettingsSection title="Featured" class="@container">
+ <div class="grid grid-cols-1 gap-3 @[460px]:grid-cols-2">
+ <For each={featured()}>
+ {(item) => (
+ <SettingsCard>
+ <button
+ type="button"
+ class="flex h-full w-full flex-col items-stretch text-left outline-none hover:bg-ink/4 focus-visible:bg-ink/6"
+ onClick={() => view.openProvider(item.id)}
+ >
+ <IntegrationRow
+ icon={providerIcon(item.id)}
+ title={item.name}
+ description={item.note}
+ >
+ <Show when={alreadyHave().has(item.id)}>
+ <AddedMark />
+ </Show>
+ <CaretRightIcon class="size-4 text-ink-extra-muted" />
+ </IntegrationRow>
+ </button>
+ </SettingsCard>
+ )}
+ </For>
+ </div>
+ <Show when={featured().length === 0}>
+ <p class="text-sm text-ink-muted">No featured Connections match.</p>
+ </Show>
+ </SettingsSection>
+
+ <SettingsSection title="Browse">
+ <SettingsCard>
+ <Show when={catalog.query.isError}>
+ <div class="px-6 py-6 text-center text-sm text-ink-muted">
+ Couldn't load the connector catalog.
+ <Button
+ variant="outline"
+ size="sm"
+ depth={3}
+ onClick={() => catalog.query.refetch()}
+ class="ml-2"
+ >
+ Retry
+ </Button>
+ </div>
+ </Show>
+ <Show when={!catalog.query.isError}>
+ <For each={rest()}>
+ {(entry) => (
+ <CatalogRow
+ entry={entry}
+ added={alreadyHave().has(entry.app_slug)}
+ />
+ )}
+ </For>
+ <Show
+ when={
+ !catalog.query.isFetching &&
+ rest().length === 0 &&
+ catalog.search().trim()
+ }
+ >
+ <p class="px-6 py-6 text-sm text-ink-muted">
+ No Connections match that search.
+ </p>
+ </Show>
+ <Show when={catalog.query.isFetching}>
+ <div
+ class="flex justify-center px-6 py-6"
+ role="status"
+ aria-label="Loading"
+ >
+ <SpinnerIcon class="size-4 animate-spin text-ink-muted" />
+ </div>
+ </Show>
+ <Show
+ when={
+ rest().length > 0 &&
+ !catalog.query.isFetching &&
+ catalog.query.hasNextPage
+ }
+ >
+ <div class="px-4 py-3 text-center">
+ <Button
+ variant="outline"
+ size="sm"
+ depth={3}
+ onClick={() => void catalog.query.fetchNextPage()}
+ >
+ Load more
+ </Button>
+ </div>
+ </Show>
+ </Show>
+ </SettingsCard>
+ </SettingsSection>
+
+ <SettingsCard>
+ <button
+ type="button"
+ class="w-full text-left outline-none hover:bg-ink/4 focus-visible:bg-ink/6"
+ onClick={() => setAddingCustom(true)}
+ >
+ <IntegrationRow
+ icon={<PlusIcon />}
+ title="Add custom MCP"
+ description="Give Macro's agent access to the tools your team already uses."
+ >
+ <CaretRightIcon class="size-4 text-ink-extra-muted" />
+ </IntegrationRow>
+ </button>
+ </SettingsCard>
+
+ <AddCustomMcpDialog
+ open={addingCustom()}
+ onOpenChange={setAddingCustom}
+ onAdded={view.showOverview}
+ />
+ </div>
+ );
+}
+
+function AddedMark() {
+ return (
+ <span
+ class="inline-flex shrink-0 items-center gap-1 text-sm text-ink-muted"
+ aria-label="Added"
+ >
+ <CheckIcon class="size-3.5" />
+ <span class="hidden @[16rem]:inline" aria-hidden="true">
+ Added
+ </span>
+ </span>
+ );
+}
+
+function CatalogRow(props: {
+ entry: PipedreamCatalogEntryResponse;
+ added: boolean;
+}) {
+ const { connect, busy } = createPipedreamCatalogConnect({
+ entry: () => props.entry,
+ onConnected: (entry) => toast.success(`${entry.display_name} connected`),
+ });
+
+ const name = () => props.entry.display_name;
+ const descriptionId = `discover-connect-${props.entry.app_slug}`;
+ const description = props.entry.description ?? props.entry.app_slug;
+
+ const row = () => (
+ <IntegrationRow
+ icon={
+ <PipedreamConnectorIcon
+ appSlug={props.entry.app_slug}
+ iconUrl={props.entry.icon_url}
+ class="size-8"
+ />
+ }
+ title={name()}
+ description={<span id={descriptionId}>{description}</span>}
+ >
+ <Show
+ when={props.added}
+ fallback={<ConnectAction label="Connect" loading={busy()} />}
+ >
+ <AddedMark />
+ </Show>
+ </IntegrationRow>
+ );
+
+ return (
+ <Show when={!props.added} fallback={row()}>
+ <button
+ type="button"
+ class="w-full text-left outline-none hover:bg-ink/4 focus-visible:bg-ink/6"
+ aria-label={busy() ? `Connecting ${name()}` : `Connect ${name()}`}
+ aria-describedby={descriptionId}
+ aria-busy={busy()}
+ disabled={busy()}
+ onClick={() => void connect()}
+ >
+ {row()}
+ </button>
+ </Show>
+ );
+}
diff --git a/apps/web/src/features/settings/connections/PipedreamAiProvider.tsx b/apps/web/src/features/settings/connections/PipedreamAiProvider.tsx
new file mode 100644
index 0000000000..490386c21c
--- /dev/null
+++ b/apps/web/src/features/settings/connections/PipedreamAiProvider.tsx
@@ -0,0 +1,190 @@
+import { toast } from '@core/component/Toast/Toast';
+import { createPipedreamCatalogConnect } from '@core/pipedream/catalog';
+import {
+ useDeletePipedreamConnectionMutation,
+ useUpdatePipedreamConnectionMutation,
+} from '@queries/pipedream-connectors';
+import { createSignal, type JSX } from 'solid-js';
+import { AiGrantActions } from './ai-grant-actions';
+import { capabilityFacts } from './capability-row';
+import {
+ type DisconnectConfirm,
+ DisconnectConfirmDialog,
+} from './disconnect-confirm';
+import {
+ type ConnectionsModel,
+ CURATED_AI,
+ type CuratedAiProvider,
+ capabilitiesFor,
+} from './model';
+import { useNativeMcpActions } from './native-actions';
+import {
+ IntegrationRow,
+ SettingsCard,
+ SettingsPage,
+ SettingsSection,
+} from './primitives';
+import { providerIcon } from './provider-meta';
+import { useConnectionsView } from './view-state';
+
+const COPY: Record<
+ CuratedAiProvider,
+ { title: string; name: string; outcome: string }
+> = {
+ github: {
+ title: 'GitHub',
+ name: 'GitHub',
+ outcome: CURATED_AI.github.outcome,
+ },
+ linear: {
+ title: 'Linear',
+ name: 'Linear',
+ outcome: CURATED_AI.linear.outcome,
+ },
+ notion: {
+ title: 'Notion',
+ name: 'Notion',
+ outcome: CURATED_AI.notion.outcome,
+ },
+ slack: {
+ title: 'Slack',
+ name: 'Slack',
+ outcome: CURATED_AI.slack.outcome,
+ },
+};
+
+export function PipedreamAiProvider(props: {
+ model: ConnectionsModel;
+ provider: CuratedAiProvider;
+}) {
+ const view = useConnectionsView();
+ const copy = COPY[props.provider];
+ const row = () =>
+ capabilitiesFor(props.model, props.provider).find(
+ (item) => item.kind === 'ai'
+ );
+ const aiFacts = () => {
+ const cap = row();
+ return cap ? capabilityFacts(cap) : 'Powered by Pipedream';
+ };
+ const update = useUpdatePipedreamConnectionMutation();
+ const remove = useDeletePipedreamConnectionMutation();
+ const native = useNativeMcpActions();
+ const { connect, busy } = createPipedreamCatalogConnect({
+ entry: () => ({
+ app_slug: props.provider,
+ display_name: copy.name,
+ }),
+ onConnected: () => toast.success(`${copy.name} connected`),
+ });
+
+ const [disconnect, setDisconnect] = createSignal<DisconnectConfirm | null>(
+ null
+ );
+
+ const setEnabled = (enabled: boolean) => {
+ const cap = row();
+ if (!cap) return;
+ if (cap.mechanism === 'native-mcp') {
+ const url = cap.sourceUrl;
+ if (!url) return;
+ native.update.mutate(
+ { url, enabled },
+ { onError: () => toast.failure('Failed to update connector') }
+ );
+ return;
+ }
+ update.mutate(
+ { app_slug: props.provider, enabled },
+ { onError: () => toast.failure('Failed to update connector') }
+ );
+ };
+
+ const askDisconnect = () => {
+ const cap = row();
+ if (!cap) return;
+ if (cap.mechanism === 'native-mcp') {
+ const url = cap.sourceUrl;
+ if (!url) return;
+ setDisconnect({
+ title: 'Disconnect from Macro',
+ body: `Disconnect ${copy.name}?`,
+ onConfirm: () =>
+ native.remove.mutate(
+ { url },
+ {
+ onSuccess: () =>
+ toast.success(`Disconnected ${copy.name} from Macro`),
+ onError: () => toast.failure('Failed to disconnect'),
+ }
+ ),
+ });
+ return;
+ }
+ setDisconnect({
+ title: 'Disconnect from Macro',
+ body: `Disconnect ${copy.name}?`,
+ onConfirm: () =>
+ remove.mutate(
+ { app_slug: props.provider },
+ {
+ onSuccess: () =>
+ toast.success(`Disconnected ${copy.name} from Macro`),
+ onError: () => toast.failure('Failed to disconnect'),
+ }
+ ),
+ });
+ };
+
+ const reconnect = () => {
+ const cap = row();
+ if (!cap) return;
+ if (cap.mechanism === 'native-mcp') {
+ const url = cap.sourceUrl;
+ if (!url) return;
+ native.startAuth(url, cap.account || copy.name);
+ return;
+ }
+ void connect();
+ };
+
+ const actions = (): JSX.Element => (
+ <AiGrantActions
+ status={row()?.status ?? 'not-connected'}
+ onConnect={() => void connect()}
+ onReconnect={reconnect}
+ onEnable={() => setEnabled(true)}
+ onDisable={() => setEnabled(false)}
+ onDisconnect={askDisconnect}
+ connectBusy={busy()}
+ authPending={native.authorize.isPending}
+ updatePending={native.update.isPending || update.isPending}
+ removePending={native.remove.isPending || remove.isPending}
+ />
+ );
+
+ return (
+ <SettingsPage
+ title={copy.title}
+ icon={providerIcon(props.provider)}
+ onBack={view.closeProvider}
+ >
+ <SettingsSection title="Your Connections">
+ <SettingsCard>
+ <IntegrationRow
+ title={copy.title}
+ description={copy.outcome}
+ facts={aiFacts()}
+ muted={row()?.status === 'off'}
+ >
+ {actions()}
+ </IntegrationRow>
+ </SettingsCard>
+ </SettingsSection>
+ <DisconnectConfirmDialog
+ request={disconnect()}
+ onClose={() => setDisconnect(null)}
+ />
+ </SettingsPage>
+ );
+}
diff --git a/apps/web/src/features/settings/connections/add-custom-mcp-dialog.tsx b/apps/web/src/features/settings/connections/add-custom-mcp-dialog.tsx
new file mode 100644
index 0000000000..b8cf72a702
--- /dev/null
+++ b/apps/web/src/features/settings/connections/add-custom-mcp-dialog.tsx
@@ -0,0 +1,111 @@
+import { toast } from '@core/component/Toast/Toast';
+import { useAddMcpServerMutation } from '@queries/mcp-servers';
+import { Button, Dialog, Panel } from '@ui';
+import { createSignal } from 'solid-js';
+
+export function AddCustomMcpDialog(props: {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ onAdded?: () => void;
+}) {
+ const [name, setName] = createSignal('');
+ const [url, setUrl] = createSignal('');
+ const addMutation = useAddMcpServerMutation();
+
+ const reset = () => {
+ setName('');
+ setUrl('');
+ };
+
+ const close = () => {
+ reset();
+ props.onOpenChange(false);
+ };
+
+ const handleSubmit = () => {
+ if (addMutation.isPending) return;
+ const n = name().trim();
+ const u = url().trim();
+ if (!n || !u) return;
+
+ addMutation.mutate(
+ { server_name: n, url: u },
+ {
+ onSuccess: () => {
+ close();
+ props.onAdded?.();
+ },
+ onError: () => {
+ toast.failure('Failed to add server');
+ },
+ }
+ );
+ };
+
+ return (
+ <Dialog
+ open={props.open}
+ onOpenChange={(open) => {
+ if (!open) close();
+ }}
+ position="center"
+ visibleScrim
+ class="w-100"
+ >
+ <Panel depth={2} class="rounded-xl">
+ <Panel.Header class="px-6">
+ <span class="text-ink text-sm font-semibold">Add MCP Server</span>
+ </Panel.Header>
+ <Panel.Body class="p-6 flex flex-col gap-5">
+ <div class="flex flex-col gap-4">
+ <label class="flex flex-col gap-1.5">
+ <span class="text-xs text-ink-muted">Name</span>
+ <input
+ type="text"
+ class="settings-input w-full"
+ placeholder="My MCP Server"
+ value={name()}
+ onInput={(e) => setName(e.currentTarget.value)}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') handleSubmit();
+ if (e.key === 'Escape') close();
+ }}
+ />
+ </label>
+ <label class="flex flex-col gap-1.5">
+ <span class="text-xs text-ink-muted">URL</span>
+ <input
+ type="url"
+ class="settings-input w-full"
+ placeholder="https://example.com/mcp"
+ value={url()}
+ onInput={(e) => setUrl(e.currentTarget.value)}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') handleSubmit();
+ if (e.key === 'Escape') close();
+ }}
+ />
+ </label>
+ </div>
+
+ <div class="flex justify-end gap-2 pt-1">
+ <Button variant="outline" size="sm" depth={3} onClick={close}>
+ Cancel
+ </Button>
+ <Button
+ variant="accent"
+ size="sm"
+ depth={3}
+ disabled={
+ !name().trim() || !url().trim() || addMutation.isPending
+ }
+ onClick={handleSubmit}
+ >
+ {addMutation.isPending ? 'Adding...' : 'Add'}
+ </Button>
+ </div>
+ </Panel.Body>
+ </Panel>
+ </Dialog>
+ );
+}
diff --git a/apps/web/src/features/settings/connections/ai-grant-actions.tsx b/apps/web/src/features/settings/connections/ai-grant-actions.tsx
new file mode 100644
index 0000000000..ed727c2942
--- /dev/null
+++ b/apps/web/src/features/settings/connections/ai-grant-actions.tsx
@@ -0,0 +1,93 @@
+import type { JSX } from 'solid-js';
+import { match } from 'ts-pattern';
+import {
+ type ConnectionMenuItem,
+ ConnectionRowActions,
+} from './connection-more';
+import { ConnectAction } from './integration-ui';
+import type { CapabilityStatus } from './model';
+
+export function AiGrantActions(props: {
+ status: CapabilityStatus;
+ onConnect: () => void;
+ onReconnect: () => void;
+ onEnable: () => void;
+ onDisable: () => void;
+ onDisconnect: () => void;
+ connectBusy?: boolean;
+ authPending?: boolean;
+ updatePending?: boolean;
+ removePending?: boolean;
+}): JSX.Element {
+ const reconnectItem = (): ConnectionMenuItem => ({
+ label: 'Reconnect',
+ onSelect: props.onReconnect,
+ disabled: props.authPending || props.connectBusy,
+ icon: 'reconnect',
+ });
+ const disconnectItem = (): ConnectionMenuItem => ({
+ label: 'Disconnect',
+ danger: true,
+ onSelect: props.onDisconnect,
+ disabled: props.removePending,
+ icon: 'disconnect',
+ });
+
+ return (
+ <>
+ {match(props.status)
+ .with('not-connected', () => (
+ <ConnectionRowActions
+ primary={
+ <ConnectAction
+ label="Connect"
+ onClick={props.onConnect}
+ loading={props.connectBusy}
+ />
+ }
+ items={[]}
+ />
+ ))
+ .with('action-required', () => (
+ <ConnectionRowActions
+ primary={
+ <ConnectAction
+ label="Reconnect"
+ onClick={props.onReconnect}
+ disabled={props.authPending || props.connectBusy}
+ />
+ }
+ items={[reconnectItem(), disconnectItem()]}
+ />
+ ))
+ .with('connected', () => (
+ <ConnectionRowActions
+ items={[
+ {
+ label: 'Disable',
+ onSelect: props.onDisable,
+ disabled: props.updatePending,
+ icon: 'disable',
+ },
+ reconnectItem(),
+ disconnectItem(),
+ ]}
+ />
+ ))
+ .with('off', () => (
+ <ConnectionRowActions
+ primary={
+ <ConnectAction
+ label="Enable"
+ variant="neutral"
+ onClick={props.onEnable}
+ disabled={props.updatePending}
+ />
+ }
+ items={[reconnectItem(), disconnectItem()]}
+ />
+ ))
+ .exhaustive()}
+ </>
+ );
+}
diff --git a/apps/web/src/features/settings/connections/capability-row.ts b/apps/web/src/features/settings/connections/capability-row.ts
new file mode 100644
index 0000000000..c8c4875861
--- /dev/null
+++ b/apps/web/src/features/settings/connections/capability-row.ts
@@ -0,0 +1,13 @@
+import type { Capability, CapabilityScope } from './model';
+
+const SCOPE_LABEL: Record<CapabilityScope, string> = {
+ personal: 'Personal',
+ shared: 'Shared',
+};
+
+export function capabilityFacts(
+ row: Pick<Capability, 'account' | 'scope' | 'mechanism'>
+): string {
+ if (row.mechanism === 'pipedream') return 'Powered by Pipedream';
+ return [row.account, SCOPE_LABEL[row.scope]].filter(Boolean).join(' · ');
+}
diff --git a/apps/web/src/features/settings/connections/connection-more.tsx b/apps/web/src/features/settings/connections/connection-more.tsx
new file mode 100644
index 0000000000..be6f435d15
--- /dev/null
+++ b/apps/web/src/features/settings/connections/connection-more.tsx
@@ -0,0 +1,80 @@
+import ArrowsClockwiseIcon from '@phosphor/arrows-clockwise.svg';
+import DotsThreeIcon from '@phosphor/dots-three.svg';
+import LinkBreakIcon from '@phosphor/link-break.svg';
+import PencilSimpleIcon from '@phosphor/pencil-simple.svg';
+import PowerIcon from '@phosphor/power.svg';
+import { Dropdown } from '@ui';
+import { For, type JSX, Show } from 'solid-js';
+import { match } from 'ts-pattern';
+
+export type ConnectionMenuIcon =
+ | 'disable'
+ | 'rename'
+ | 'reconnect'
+ | 'disconnect';
+
+export type ConnectionMenuItem = {
+ label: string;
+ onSelect: () => void;
+ disabled?: boolean;
+ danger?: boolean;
+ icon: ConnectionMenuIcon;
+};
+
+function MenuItemIcon(props: { item: ConnectionMenuItem }): JSX.Element {
+ return match(props.item.icon)
+ .with('disable', () => <PowerIcon class="size-4" />)
+ .with('rename', () => <PencilSimpleIcon class="size-4" />)
+ .with('reconnect', () => <ArrowsClockwiseIcon class="size-4" />)
+ .with('disconnect', () => <LinkBreakIcon class="size-4" />)
+ .exhaustive();
+}
+
+export function ConnectionMore(props: {
+ items: ConnectionMenuItem[];
+}): JSX.Element {
+ return (
+ <Show when={props.items.length > 0}>
+ <Dropdown>
+ <Dropdown.Trigger
+ aria-label="More"
+ class="relative inline-flex size-6 items-center justify-center rounded-md border-1 border-edge bg-transparent text-ink-muted outline-none hover:bg-hover hover:text-ink"
+ >
+ <DotsThreeIcon class="size-4" />
+ </Dropdown.Trigger>
+ <Dropdown.Content class="w-48">
+ <Dropdown.Group>
+ <For each={props.items}>
+ {(item) => (
+ <Dropdown.Item
+ class={
+ item.danger
+ ? 'text-failure data-highlighted:bg-failure-bg'
+ : undefined
+ }
+ disabled={item.disabled}
+ onSelect={item.onSelect}
+ >
+ <MenuItemIcon item={item} />
+ {item.label}
+ </Dropdown.Item>
+ )}
+ </For>
+ </Dropdown.Group>
+ </Dropdown.Content>
+ </Dropdown>
+ </Show>
+ );
+}
+
+export function ConnectionRowActions(props: {
+ primary?: JSX.Element;
+ items: ConnectionMenuItem[];
+}): JSX.Element {
+ return (
+ <div class="flex items-center gap-2">
+ {props.primary}
+ <ConnectionMore items={props.items} />
+ </div>
+ );
+}
diff --git a/apps/web/src/features/settings/connections/disconnect-confirm.tsx b/apps/web/src/features/settings/connections/disconnect-confirm.tsx
new file mode 100644
index 0000000000..4cb2d12fce
--- /dev/null
+++ b/apps/web/src/features/settings/connections/disconnect-confirm.tsx
@@ -0,0 +1,32 @@
+import { ConfirmDialog } from '@ui';
+
+export type DisconnectConfirm = {
+ title: string;
+ body: string;
+ confirmLabel?: string;
+ onConfirm: () => void;
+};
+
+export function DisconnectConfirmDialog(props: {
+ request: DisconnectConfirm | null;
+ onClose: () => void;
+}) {
+ return (
+ <ConfirmDialog
+ open={props.request !== null}
+ onOpenChange={(open) => {
+ if (!open) props.onClose();
+ }}
+ title={props.request?.title ?? 'Disconnect from Macro'}
+ body={props.request?.body}
+ confirmLabel={props.request?.confirmLabel ?? 'Disconnect'}
+ tone="danger"
+ onConfirm={() => {
+ const request = props.request;
+ if (!request) return;
+ props.onClose();
+ request.onConfirm();
+ }}
+ />
+ );
+}
diff --git a/apps/web/src/features/settings/connections/integration-ui.tsx b/apps/web/src/features/settings/connections/integration-ui.tsx
new file mode 100644
index 0000000000..cc61abd2b8
--- /dev/null
+++ b/apps/web/src/features/settings/connections/integration-ui.tsx
@@ -0,0 +1,86 @@
+import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';
+import SpinnerIcon from '@phosphor/spinner-gap.svg';
+import { cn } from '@ui';
+import { type JSX, Show } from 'solid-js';
+
+/*
+ * Trailing actions for Connections cards, including a non-interactive label
+ * when the entire row is already a button.
+ */
+
+/**
+ * The trailing action on an integration row. Defaults to a quiet text+arrow
+ * "Connect" affordance (mirrors Linear's link-style connect button); pass
+ * `variant` to render a neutral or destructive action.
+ */
+export function ConnectAction(props: {
+ label: JSX.Element;
+ onClick?: () => void;
+ href?: string;
+ disabled?: boolean;
+ loading?: boolean;
+ ariaLabel?: string;
+ /** 'connect' shows the external-link arrow; the others are plain buttons. */
+ variant?: 'connect' | 'neutral' | 'danger';
+}) {
+ const variant = () => props.variant ?? 'connect';
+ const className = () =>
+ cn(
+ 'inline-flex items-center gap-1.5 h-7 px-2 rounded-md text-sm font-medium',
+ 'cursor-default transition-colors',
+ 'outline-none focus-visible:bg-ink/6',
+ props.disabled || props.loading
+ ? 'opacity-50 pointer-events-none'
+ : undefined,
+ variant() === 'danger'
+ ? 'text-ink-muted hover:bg-ink/4 hover:text-failure'
+ : 'text-ink-muted hover:bg-ink/4 hover:text-ink'
+ );
+ const body = (
+ <>
+ <Show when={props.loading}>
+ <SpinnerIcon class="size-4 animate-spin" />
+ </Show>
+ {props.label}
+ <Show when={variant() === 'connect' && !props.loading}>
+ <ArrowUpRightIcon class="size-3.5 opacity-70" />
+ </Show>
+ </>
+ );
+ if (props.href) {
+ const inert = () => Boolean(props.disabled || props.loading);
+ return (
+ <a
+ href={props.href}
+ target="_blank"
+ rel="noopener noreferrer"
+ aria-label={props.ariaLabel}
+ aria-disabled={inert() || undefined}
+ onClick={(event) => {
+ if (inert()) event.preventDefault();
+ }}
+ class={className()}
+ >
+ {body}
+ </a>
+ );
+ }
+ if (!props.onClick) {
+ return (
+ <span aria-hidden="true" class={cn(className(), 'pointer-events-none')}>
+ {body}
+ </span>
+ );
+ }
+ return (
+ <button
+ type="button"
+ disabled={props.disabled || props.loading}
+ aria-label={props.ariaLabel}
+ onClick={() => props.onClick?.()}
+ class={className()}
+ >
+ {body}
+ </button>
+ );
+}
diff --git a/apps/web/src/features/settings/connections/leftover-row.tsx b/apps/web/src/features/settings/connections/leftover-row.tsx
new file mode 100644
index 0000000000..b1ebeec83d
--- /dev/null
+++ b/apps/web/src/features/settings/connections/leftover-row.tsx
@@ -0,0 +1,374 @@
+import { toast } from '@core/component/Toast/Toast';
+import { PipedreamConnectorIcon } from '@core/pipedream/ConnectorIcon';
+import { createPipedreamCatalogConnect } from '@core/pipedream/catalog';
+import {
+ useDeletePipedreamConnectionMutation,
+ useUpdatePipedreamConnectionMutation,
+} from '@queries/pipedream-connectors';
+import { Button, Dialog, Panel } from '@ui';
+import { createEffect, createSignal, type JSX, on, Show } from 'solid-js';
+import { match } from 'ts-pattern';
+import {
+ readMcpAuthAttempted,
+ writeMcpAuthAttempted,
+} from '../mcp-auth-attempt';
+import {
+ type ConnectionMenuItem,
+ ConnectionRowActions,
+} from './connection-more';
+import {
+ type DisconnectConfirm,
+ DisconnectConfirmDialog,
+} from './disconnect-confirm';
+import { ConnectAction } from './integration-ui';
+import type { Leftover } from './model';
+import { useNativeMcpActions } from './native-actions';
+import { IntegrationRow, SettingsRow } from './primitives';
+
+function leftoverDisabled(leftover: Leftover): boolean {
+ return match(leftover)
+ .with({ kind: 'native-mcp' }, (row) => row.authenticated && !row.enabled)
+ .with({ kind: 'pipedream' }, (row) => !row.enabled)
+ .exhaustive();
+}
+
+export function LeftoverRow(props: { leftover: Leftover }) {
+ const [disconnect, setDisconnect] = createSignal<DisconnectConfirm | null>(
+ null
+ );
+ const [renaming, setRenaming] = createSignal(false);
+ const [nameDraft, setNameDraft] = createSignal('');
+ const native = useNativeMcpActions();
+ const updatePipedream = useUpdatePipedreamConnectionMutation();
+ const deletePipedream = useDeletePipedreamConnectionMutation();
+ const [attempted, setAttempted] = createSignal(
+ props.leftover.kind === 'native-mcp'
+ ? readMcpAuthAttempted(props.leftover.url)
+ : false
+ );
+ const [justStarted, setJustStarted] = createSignal(false);
+ const { connect: connectPipedream, busy: pipedreamConnectBusy } =
+ createPipedreamCatalogConnect({
+ entry: () =>
+ props.leftover.kind === 'pipedream'
+ ? {
+ app_slug: props.leftover.appSlug,
+ display_name: props.leftover.title,
+ }
+ : { app_slug: '', display_name: props.leftover.title },
+ });
+
+ createEffect(
+ on(
+ () => {
+ const leftover = props.leftover;
+ return leftover.kind === 'native-mcp' && leftover.authenticated
+ ? leftover.url
+ : null;
+ },
+ (url) => {
+ if (url) writeMcpAuthAttempted(url, false);
+ }
+ )
+ );
+
+ const busy = () =>
+ native.update.isPending ||
+ native.remove.isPending ||
+ native.authorize.isPending ||
+ updatePipedream.isPending ||
+ deletePipedream.isPending ||
+ pipedreamConnectBusy();
+
+ const connectionFailed = () => {
+ const leftover = props.leftover;
+ return (
+ leftover.kind === 'native-mcp' &&
+ !leftover.authenticated &&
+ !justStarted() &&
+ attempted()
+ );
+ };
+
+ const toggle = () => {
+ match(props.leftover)
+ .with({ kind: 'native-mcp' }, (leftover) => {
+ native.update.mutate(
+ { url: leftover.url, enabled: !leftover.enabled },
+ { onError: () => toast.failure('Failed to update server') }
+ );
+ })
+ .with({ kind: 'pipedream' }, (leftover) => {
+ updatePipedream.mutate(
+ { app_slug: leftover.appSlug, enabled: !leftover.enabled },
+ { onError: () => toast.failure('Failed to update connector') }
+ );
+ })
+ .exhaustive();
+ };
+
+ const remove = (connected: boolean) => {
+ const leftover = props.leftover;
+ const ok = connected ? 'Disconnected from Macro' : 'Removed';
+ const fail = connected ? 'Failed to disconnect' : 'Failed to remove';
+ match(leftover)
+ .with({ kind: 'native-mcp' }, (row) => {
+ native.remove.mutate(
+ { url: row.url },
+ {
+ onSuccess: () => toast.success(ok),
+ onError: () => toast.failure(fail),
+ }
+ );
+ })
+ .with({ kind: 'pipedream' }, (row) => {
+ deletePipedream.mutate(
+ { app_slug: row.appSlug },
+ {
+ onSuccess: () => toast.success(ok),
+ onError: () => toast.failure(fail),
+ }
+ );
+ })
+ .exhaustive();
+ };
+
+ const startAuth = () => {
+ const leftover = props.leftover;
+ if (leftover.kind !== 'native-mcp') return;
+ native.startAuth(leftover.url, leftover.title, {
+ onStarted: () => {
+ setAttempted(true);
+ setJustStarted(true);
+ },
+ onFailed: () => {
+ setAttempted(true);
+ setJustStarted(false);
+ },
+ });
+ };
+
+ const askRemove = (connected: boolean) =>
+ setDisconnect({
+ title: connected ? 'Disconnect from Macro' : 'Remove',
+ body: connected
+ ? `Disconnect ${props.leftover.title}?`
+ : `Remove ${props.leftover.title}?`,
+ confirmLabel: connected ? 'Disconnect' : 'Remove',
+ onConfirm: () => remove(connected),
+ });
+
+ const openRename = () => {
+ if (props.leftover.kind !== 'native-mcp') return;
+ setNameDraft(props.leftover.title);
+ setRenaming(true);
+ };
+
+ const saveRename = () => {
+ const leftover = props.leftover;
+ if (leftover.kind !== 'native-mcp') return;
+ const name = nameDraft().trim();
+ if (!name) return;
+ native.update.mutate(
+ { url: leftover.url, server_name: name },
+ {
+ onSuccess: () => setRenaming(false),
+ onError: () => toast.failure('Failed to update server'),
+ }
+ );
+ };
+
+ const disconnectItem = (connected = true): ConnectionMenuItem => ({
+ label: connected ? 'Disconnect' : 'Remove',
+ onSelect: () => askRemove(connected),
+ disabled: busy(),
+ danger: true,
+ icon: 'disconnect',
+ });
+
+ const renameItem = (): ConnectionMenuItem => ({
+ label: 'Rename',
+ onSelect: openRename,
+ disabled: busy(),
+ icon: 'rename',
+ });
+
+ const reconnectItem = (): ConnectionMenuItem => ({
+ label: 'Reconnect',
+ icon: 'reconnect',
+ onSelect: () => {
+ match(props.leftover)
+ .with({ kind: 'native-mcp' }, () => {
+ startAuth();
+ })
+ .with({ kind: 'pipedream' }, () => {
+ void connectPipedream();
+ })
+ .exhaustive();
+ },
+ disabled: busy(),
+ });
+
+ const actions = (): JSX.Element =>
+ match(props.leftover)
+ .with({ kind: 'native-mcp', authenticated: false }, () => (
+ <ConnectionRowActions
+ primary={
+ <ConnectAction
+ label="Connect"
+ onClick={startAuth}
+ disabled={busy()}
+ />
+ }
+ items={[renameItem(), disconnectItem(false)]}
+ />
+ ))
+ .with({ kind: 'native-mcp', enabled: true }, () => (
+ <ConnectionRowActions
+ items={[
+ {
+ label: 'Disable',
+ onSelect: toggle,
+ disabled: busy(),
+ icon: 'disable',
+ },
+ renameItem(),
+ reconnectItem(),
+ disconnectItem(),
+ ]}
+ />
+ ))
+ .with({ kind: 'native-mcp' }, () => (
+ <ConnectionRowActions
+ primary={
+ <ConnectAction
+ label="Enable"
+ variant="neutral"
+ onClick={toggle}
+ disabled={busy()}
+ />
+ }
+ items={[renameItem(), reconnectItem(), disconnectItem()]}
+ />
+ ))
+ .with({ kind: 'pipedream', enabled: true }, () => (
+ <ConnectionRowActions
+ items={[
+ {
+ label: 'Disable',
+ onSelect: toggle,
+ disabled: busy(),
+ icon: 'disable',
+ },
+ reconnectItem(),
+ disconnectItem(),
+ ]}
+ />
+ ))
+ .with({ kind: 'pipedream' }, () => (
+ <ConnectionRowActions
+ primary={
+ <ConnectAction
+ label="Enable"
+ variant="neutral"
+ onClick={toggle}
+ disabled={busy()}
+ />
+ }
+ items={[reconnectItem(), disconnectItem()]}
+ />
+ ))
+ .exhaustive();
+
+ const row = (): JSX.Element => {
+ const leftover = props.leftover;
+ const muted = leftoverDisabled(leftover);
+ return match(leftover)
+ .with({ kind: 'native-mcp' }, (item) => (
+ <SettingsRow
+ label={item.title}
+ description={
+ <>
+ <span class="block truncate">{item.subtitle}</span>
+ <Show when={connectionFailed()}>
+ <span class="block text-failure">Last attempt failed</span>
+ </Show>
+ </>
+ }
+ muted={muted}
+ >
+ {actions()}
+ </SettingsRow>
+ ))
+ .with({ kind: 'pipedream' }, (item) => (
+ <IntegrationRow
+ icon={
+ <PipedreamConnectorIcon appSlug={item.appSlug} class="size-8" />
+ }
+ title={item.title}
+ description={item.subtitle}
+ muted={muted}
+ >
+ {actions()}
+ </IntegrationRow>
+ ))
+ .exhaustive();
+ };
+
+ return (
+ <>
+ {row()}
+ <DisconnectConfirmDialog
+ request={disconnect()}
+ onClose={() => setDisconnect(null)}
+ />
+ <Dialog
+ open={renaming()}
+ onOpenChange={(open) => !open && setRenaming(false)}
+ position="center"
+ visibleScrim
+ class="w-100"
+ >
+ <Panel depth={2} class="rounded-xl">
+ <Panel.Header class="px-6">
+ <span class="text-ink text-sm font-semibold">Rename</span>
+ </Panel.Header>
+ <Panel.Body class="p-6 flex flex-col gap-5">
+ <label class="flex flex-col gap-1.5">
+ <span class="text-xs text-ink-muted">Name</span>
+ <input
+ type="text"
+ class="settings-input w-full"
+ value={nameDraft()}
+ onInput={(e) => setNameDraft(e.currentTarget.value)}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') saveRename();
+ if (e.key === 'Escape') setRenaming(false);
+ }}
+ />
+ </label>
+ <div class="flex justify-end gap-2">
+ <Button
+ variant="outline"
+ size="sm"
+ depth={3}
+ onClick={() => setRenaming(false)}
+ >
+ Cancel
+ </Button>
+ <Button
+ variant="accent"
+ size="sm"
+ depth={3}
+ disabled={!nameDraft().trim() || native.update.isPending}
+ onClick={saveRename}
+ >
+ {native.update.isPending ? 'Saving...' : 'Save'}
+ </Button>
+ </div>
+ </Panel.Body>
+ </Panel>
+ </Dialog>
+ </>
+ );
+}
diff --git a/apps/web/src/features/settings/connections/mcp-oauth.ts b/apps/web/src/features/settings/connections/mcp-oauth.ts
new file mode 100644
index 0000000000..6b751033fb
--- /dev/null
+++ b/apps/web/src/features/settings/connections/mcp-oauth.ts
@@ -0,0 +1,18 @@
+import { isTauri } from '@core/util/platform';
+import { openExternalUrl } from '@core/util/url';
+
+/** Open a blank tab during the click so later OAuth assign is not blocked. */
+export function reserveOauthPopup(): Window | null {
+ if (isTauri()) return null;
+ const popup = window.open('about:blank', '_blank');
+ if (popup) popup.opener = null;
+ return popup;
+}
+
+export function assignOauthUrl(popup: Window | null, url: string) {
+ if (popup && !popup.closed) {
+ popup.location.href = url;
+ return;
+ }
+ openExternalUrl(url);
+}
diff --git a/apps/web/src/features/settings/connections/mock-dropdown.tsx b/apps/web/src/features/settings/connections/mock-dropdown.tsx
new file mode 100644
index 0000000000..c8b9d01668
--- /dev/null
+++ b/apps/web/src/features/settings/connections/mock-dropdown.tsx
@@ -0,0 +1,26 @@
+import type { JSX } from 'solid-js';
+
+/** Minimal Dropdown stub for connections settings tests. */
+export async function mockUiWithDropdown(
+ importOriginal: () => Promise<typeof import('@ui')>
+) {
+ const actual = await importOriginal();
+ const Dropdown = Object.assign(
+ (p: { children?: JSX.Element }) => <>{p.children}</>,
+ {
+ Trigger: (p: { 'aria-label'?: string; children?: JSX.Element }) => (
+ <button type="button" aria-label={p['aria-label']}>
+ {p.children}
+ </button>
+ ),
+ Content: (p: { children?: JSX.Element }) => <div>{p.children}</div>,
+ Group: (p: { children?: JSX.Element }) => <div>{p.children}</div>,
+ Item: (p: { children?: JSX.Element; onSelect?: () => void }) => (
+ <div role="menuitem" onClick={() => p.onSelect?.()}>
+ {p.children}
+ </div>
+ ),
+ }
+ );
+ return { ...actual, Dropdown };
+}
diff --git a/apps/web/src/features/settings/connections/model.ts b/apps/web/src/features/settings/connections/model.ts
new file mode 100644
index 0000000000..75381ca0ed
--- /dev/null
+++ b/apps/web/src/features/settings/connections/model.ts
@@ -0,0 +1,293 @@
+import type { PipedreamConnectionResponse } from '@service-cognition/client';
+import type { ServerResponse } from '@service-cognition/generated/schemas';
+
+export type CapabilityStatus =
+ | 'connected'
+ | 'off'
+ | 'action-required'
+ | 'not-connected';
+
+export type CapabilityScope = 'personal' | 'shared';
+
+export type CapabilityMechanism = 'pipedream' | 'native-mcp';
+
+export type ProviderId = CuratedAiProvider;
+
+export type CuratedAiProvider = 'github' | 'linear' | 'notion' | 'slack';
+
+export type CapabilityKind = 'ai';
+
+export type Capability = {
+ id: string;
+ kind: CapabilityKind;
+ provider: ProviderId;
+ title: string;
+ outcome: string;
+ account: string;
+ scope: CapabilityScope;
+ status: CapabilityStatus;
+ mechanism: CapabilityMechanism;
+ /** Native MCP URL, when this row is that server. */
+ sourceUrl?: string;
+};
+
+export type Leftover =
+ | {
+ kind: 'native-mcp';
+ id: string;
+ title: string;
+ subtitle: string;
+ url: string;
+ enabled: boolean;
+ authenticated: boolean;
+ }
+ | {
+ kind: 'pipedream';
+ id: string;
+ title: string;
+ subtitle: string;
+ appSlug: string;
+ enabled: boolean;
+ };
+
+export type ProviderSummary = {
+ id: ProviderId;
+ name: string;
+ ready: number;
+ total: number;
+ summary: string;
+ accounts: string;
+};
+
+export type ConnectionsModel = {
+ capabilities: Capability[];
+ leftovers: Leftover[];
+ providers: ProviderSummary[];
+};
+
+export type ConnectionsInput = {
+ pipedream: PipedreamConnectionResponse[];
+ nativeMcp: ServerResponse[];
+};
+
+export const CURATED_AI: Record<
+ CuratedAiProvider,
+ { title: string; outcome: string }
+> = {
+ github: {
+ title: 'GitHub',
+ outcome:
+ 'Macro AI can answer questions about your repos, pull requests, and issues.',
+ },
+ linear: {
+ title: 'Linear',
+ outcome:
+ 'Macro AI can create, read, and update Linear issues without leaving Macro.',
+ },
+ notion: {
+ title: 'Notion',
+ outcome: 'Macro AI can search your pages and wikis.',
+ },
+ slack: {
+ title: 'Slack',
+ outcome: 'Macro AI can search conversations and post updates for you.',
+ },
+};
+
+const NATIVE_CURATED: {
+ provider: CuratedAiProvider;
+ url: string;
+}[] = [
+ { provider: 'github', url: 'https://api.githubcopilot.com/mcp' },
+ { provider: 'linear', url: 'https://mcp.linear.app/mcp' },
+ { provider: 'notion', url: 'https://mcp.notion.com/mcp' },
+ { provider: 'slack', url: 'https://mcp.slack.com/mcp' },
+];
+
+const PROVIDER_NAMES: Record<ProviderId, string> = {
+ github: 'GitHub',
+ linear: 'Linear',
+ notion: 'Notion',
+ slack: 'Slack',
+};
+
+function nativeCuratedProvider(
+ server: ServerResponse
+): CuratedAiProvider | null {
+ const url = server.url.replace(/\/$/, '');
+ return NATIVE_CURATED.find((row) => row.url === url)?.provider ?? null;
+}
+
+function pipedreamBySlug(
+ connections: PipedreamConnectionResponse[]
+): Map<string, PipedreamConnectionResponse> {
+ return new Map(connections.map((row) => [row.app_slug, row]));
+}
+
+function aiStatus(enabled: boolean): CapabilityStatus {
+ return enabled ? 'connected' : 'off';
+}
+
+function mcpUrlPreview(url: string): string {
+ try {
+ const parsed = new URL(url);
+ const path = parsed.pathname.replace(/\/$/, '');
+ return path ? `${parsed.host}${path}` : parsed.host;
+ } catch {
+ return url;
+ }
+}
+
+function leftoverNative(server: ServerResponse): Leftover {
+ return {
+ kind: 'native-mcp',
+ id: `mcp:${server.url}`,
+ title: server.server_name,
+ subtitle: mcpUrlPreview(server.url),
+ url: server.url,
+ enabled: server.enabled,
+ authenticated: server.authenticated,
+ };
+}
+
+function curatedAiAndLeftovers(input: ConnectionsInput): {
+ capabilities: Capability[];
+ leftovers: Leftover[];
+} {
+ const pipedream = pipedreamBySlug(input.pipedream);
+ const usedNative = new Set<string>();
+ const capabilities: Capability[] = [];
+ const leftovers: Leftover[] = [];
+
+ for (const provider of Object.keys(CURATED_AI) as CuratedAiProvider[]) {
+ const copy = CURATED_AI[provider];
+ const pd = pipedream.get(provider);
+ const native = input.nativeMcp.find(
+ (server) => nativeCuratedProvider(server) === provider
+ );
+
+ if (pd) {
+ capabilities.push({
+ id: `${provider}-ai`,
+ kind: 'ai',
+ provider,
+ title: copy.title,
+ outcome: copy.outcome,
+ account: pd.server_name,
+ scope: 'personal',
+ status: aiStatus(pd.enabled),
+ mechanism: 'pipedream',
+ });
+ if (native) {
+ usedNative.add(native.url);
+ leftovers.push(leftoverNative(native));
+ }
+ continue;
+ }
+
+ if (native) {
+ usedNative.add(native.url);
+ capabilities.push({
+ id: `${provider}-ai`,
+ kind: 'ai',
+ provider,
+ title: copy.title,
+ outcome: copy.outcome,
+ account: native.server_name,
+ scope: 'personal',
+ status: native.authenticated
+ ? aiStatus(native.enabled)
+ : 'action-required',
+ mechanism: 'native-mcp',
+ sourceUrl: native.url,
+ });
+ }
+ }
+
+ for (const server of input.nativeMcp) {
+ if (usedNative.has(server.url)) continue;
+ leftovers.push(leftoverNative(server));
+ }
+
+ for (const row of input.pipedream) {
+ if (row.app_slug in CURATED_AI) continue;
+ leftovers.push({
+ kind: 'pipedream',
+ id: `pipedream:${row.app_slug}`,
+ title: row.server_name,
+ subtitle: row.app_slug,
+ appSlug: row.app_slug,
+ enabled: row.enabled,
+ });
+ }
+
+ return { capabilities, leftovers };
+}
+
+function providerSummary(
+ id: ProviderId,
+ rows: Capability[]
+): ProviderSummary | null {
+ const readyRows = rows.filter((row) => row.status === 'connected');
+ if (
+ readyRows.length === 0 &&
+ !rows.some((row) => row.status !== 'not-connected')
+ ) {
+ return null;
+ }
+
+ const accounts = [
+ ...new Set(
+ rows
+ .filter(
+ (row) =>
+ row.status !== 'not-connected' && row.mechanism !== 'pipedream'
+ )
+ .map((row) => row.account)
+ ),
+ ].join(' · ');
+
+ const summary =
+ readyRows[0]?.outcome ?? rows[0]?.outcome ?? PROVIDER_NAMES[id];
+
+ return {
+ id,
+ name: PROVIDER_NAMES[id],
+ ready: readyRows.length,
+ total: rows.length,
+ summary,
+ accounts,
+ };
+}
+
+/** Map connection records into the Connections presentation model. */
+export function toConnectionsModel(input: ConnectionsInput): ConnectionsModel {
+ const curated = curatedAiAndLeftovers(input);
+ const capabilities = [...curated.capabilities];
+
+ const order: ProviderId[] = ['github', 'linear', 'notion', 'slack'];
+ const providers = order.flatMap((id) => {
+ const summary = providerSummary(
+ id,
+ capabilities.filter((row) => row.provider === id)
+ );
+ return summary ? [summary] : [];
+ });
+
+ return {
+ capabilities,
+ leftovers: curated.leftovers,
+ providers,
+ };
+}
+
+export function capabilitiesFor(
+ model: ConnectionsModel,
+ provider: ProviderId
+): Capability[] {
+ return model.capabilities.filter((row) => row.provider === provider);
+}
+
+export function isConnectionsEmpty(model: ConnectionsModel): boolean {
+ return model.providers.length === 0 && model.leftovers.length === 0;
+}
diff --git a/apps/web/src/features/settings/connections/native-actions.ts b/apps/web/src/features/settings/connections/native-actions.ts
new file mode 100644
index 0000000000..41c13c54e3
--- /dev/null
+++ b/apps/web/src/features/settings/connections/native-actions.ts
@@ -0,0 +1,43 @@
+import { toast } from '@core/component/Toast/Toast';
+import {
+ useDeleteMcpServerMutation,
+ useStartMcpAuthMutation,
+ useUpdateMcpServerMutation,
+} from '@queries/mcp-servers';
+import { writeMcpAuthAttempted } from '../mcp-auth-attempt';
+import { assignOauthUrl, reserveOauthPopup } from './mcp-oauth';
+
+export function useNativeMcpActions() {
+ const authorize = useStartMcpAuthMutation();
+ const update = useUpdateMcpServerMutation();
+ const remove = useDeleteMcpServerMutation();
+
+ return {
+ authorize,
+ update,
+ remove,
+ startAuth: (
+ url: string,
+ name: string,
+ extras?: { onStarted?: () => void; onFailed?: () => void }
+ ) => {
+ const popup = reserveOauthPopup();
+ authorize.mutate(
+ { server_url: url, server_name: name },
+ {
+ onSuccess: (result) => {
+ assignOauthUrl(popup, result.authorization_url);
+ writeMcpAuthAttempted(url, true);
+ extras?.onStarted?.();
+ },
+ onError: () => {
+ popup?.close();
+ writeMcpAuthAttempted(url, true);
+ extras?.onFailed?.();
+ toast.failure('Failed to start authorization');
+ },
+ }
+ );
+ },
+ };
+}
diff --git a/apps/web/src/features/settings/connections/primitives.tsx b/apps/web/src/features/settings/connections/primitives.tsx
new file mode 100644
index 0000000000..eb96d9a5ff
--- /dev/null
+++ b/apps/web/src/features/settings/connections/primitives.tsx
@@ -0,0 +1,281 @@
+import CaretLeftIcon from '@phosphor/caret-left.svg';
+import { cn, Layer } from '@ui';
+import { type JSX, Show } from 'solid-js';
+
+/*
+ * Connections presentation adapted from #6151. Kept local to the Agents page
+ * so its card spacing and provider headers do not alter Harness or the mobile
+ * settings sheet.
+ *
+ * <SettingsPage title="Account" description="…">
+ * <SettingsSection title="Profile">
+ * <SettingsCard>
+ * <SettingsRow label="Email">…</SettingsRow>
+ * <SettingsRow label="Full name">…</SettingsRow>
+ * </SettingsCard>
+ * </SettingsSection>
+ * </SettingsPage>
+ */
+
+/**
+ * Scrolling page shell: a centered, max-width column with a large title and an
+ * optional one-line description, followed by the page's sections.
+ */
+export function SettingsPage(props: {
+ title: string;
+ /** Optional one-line subtitle; accepts text or inline markup (e.g. a link). */
+ description?: JSX.Element;
+ /** Quiet line under the description (e.g. a cross-tab signpost). */
+ signpost?: JSX.Element;
+ /** Brand mark left of the title. Same slot as IntegrationRow. */
+ icon?: JSX.Element;
+ /** Right-aligned controls beside the title (e.g. a global toggle). */
+ actions?: JSX.Element;
+ onBack?: () => void;
+ backLabel?: string;
+ children: JSX.Element;
+}) {
+ return (
+ <div class="h-full min-h-0 overflow-y-auto [overflow-anchor:none]">
+ {/* On mobile/tablet the page is full-frame: the chrome insets live inside the
+ scroll content (plus the usual breathing room) so pages scroll under
+ the floating header and bottom rows like every other block. */}
+ <div class="mx-auto w-full max-w-[710px] px-10 pt-14 pb-24 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]">
+ <Show when={props.onBack}>
+ <button
+ type="button"
+ class="mb-5 -ml-1.5 inline-flex items-center gap-1.5 rounded-md px-1.5 py-1 text-sm text-ink-muted outline-none hover:bg-ink/4 hover:text-ink focus-visible:bg-ink/6"
+ onClick={props.onBack}
+ >
+ <CaretLeftIcon class="size-4" />
+ {props.backLabel ?? 'Connections'}
+ </button>
+ </Show>
+ <header class="flex flex-col gap-1.5">
+ <div class="flex items-start justify-between gap-4">
+ <div class="flex min-w-0 items-center gap-3.5">
+ <Show when={props.icon}>
+ <div class="flex size-9 shrink-0 items-center justify-center [&_svg]:size-8 [&_img]:size-8">
+ {props.icon}
+ </div>
+ </Show>
+ <h1 class="min-w-0 text-2xl/tight font-semibold text-ink">
+ {props.title}
+ </h1>
+ </div>
+ <Show when={props.actions}>
+ <div class="shrink-0 pt-1">{props.actions}</div>
+ </Show>
+ </div>
+ <Show when={props.description}>
+ <p class="text-sm text-ink-muted text-balance">
+ {props.description}
+ </p>
+ </Show>
+ <Show when={props.signpost}>{props.signpost}</Show>
+ </header>
+ <div class="mt-9 flex flex-col gap-10">{props.children}</div>
+ </div>
+ </div>
+ );
+}
+
+/**
+ * A titled group within a page. The heading/description are optional so a page
+ * can also drop a bare card straight under the title.
+ */
+export function SettingsSection(props: {
+ title?: JSX.Element;
+ description?: string;
+ /** Right-aligned controls beside the section heading. */
+ actions?: JSX.Element;
+ class?: string;
+ children: JSX.Element;
+}) {
+ return (
+ <section class={cn('flex flex-col gap-3', props.class)}>
+ <Show when={props.title || props.actions}>
+ <div class="flex items-end justify-between gap-4">
+ <div class="flex flex-col gap-0.5 min-w-0">
+ <Show when={props.title}>
+ <h2 class="text-[15px] font-semibold text-ink">{props.title}</h2>
+ </Show>
+ <Show when={props.description}>
+ <p class="text-sm text-ink-muted text-balance">
+ {props.description}
+ </p>
+ </Show>
+ </div>
+ <Show when={props.actions}>
+ <div class="shrink-0">{props.actions}</div>
+ </Show>
+ </div>
+ </Show>
+ {props.children}
+ </section>
+ );
+}
+
+/**
+ * A quiet outlined card. Direct children are treated as rows and get a divider
+ * between them (via `settings-row-dividers`); a single-child card draws
+ * no divider, so it doubles as a plain container.
+ * `border-1` is 1px. The default `border` utility is a 0.5px hairline.
+ */
+export function SettingsCard(props: { class?: string; children: JSX.Element }) {
+ // Raised a level above the content panel so the card reads as a subtly
+ // lighter surface (theme-safe via the depth system) rather than just an
+ // outline on the same fill.
+ return (
+ <Layer depth={2}>
+ <div
+ class={cn(
+ '@container rounded-xl border-1 border-ink/[0.05] bg-surface overflow-hidden settings-row-dividers',
+ props.class
+ )}
+ >
+ {props.children}
+ </div>
+ </Layer>
+ );
+}
+
+/**
+ * A label (with optional sub-text) on the left and its control on the right.
+ * `align="start"` top-aligns the two columns for taller controls.
+ */
+export function SettingsRow(props: {
+ label: JSX.Element;
+ description?: JSX.Element;
+ children?: JSX.Element;
+ align?: 'center' | 'start';
+ /** Hide the description on mobile, where the row is too cramped for it. */
+ hideDescriptionOnMobile?: boolean;
+ /**
+ * Below a 460px container width, stack the control on its own row beneath
+ * the label/description instead of keeping it in a right-hand column.
+ * Requires an ancestor carrying `@container`.
+ */
+ stackOnNarrow?: boolean;
+ /** Soften the label when the row is paused / disabled. */
+ muted?: boolean;
+ class?: string;
+}) {
+ return (
+ <div
+ class={cn(
+ 'flex gap-4 px-6 py-3.5 min-h-[60px]',
+ props.stackOnNarrow
+ ? 'flex-col gap-3 @[460px]:flex-row @[460px]:justify-between @[460px]:gap-4'
+ : 'justify-between',
+ // Cross-axis alignment only makes sense once the row is horizontal, so
+ // gate it behind the container width when stacking.
+ props.align === 'start'
+ ? props.stackOnNarrow
+ ? '@[460px]:items-start'
+ : 'items-start'
+ : props.stackOnNarrow
+ ? '@[460px]:items-center'
+ : 'items-center',
+ props.class
+ )}
+ >
+ <div class="flex flex-col gap-0.5 min-w-0">
+ <div
+ class={cn(
+ 'text-sm font-medium truncate',
+ props.muted ? 'text-ink-muted' : 'text-ink'
+ )}
+ >
+ {props.label}
+ </div>
+ <Show when={props.description}>
+ <div
+ class={cn(
+ 'text-xs text-ink-extra-muted text-balance mobile:text-[11px]',
+ props.hideDescriptionOnMobile && 'mobile:hidden'
+ )}
+ >
+ {props.description}
+ </div>
+ </Show>
+ </div>
+ <Show when={props.children}>
+ <div
+ class={cn(
+ 'flex items-center gap-2',
+ props.stackOnNarrow
+ ? 'w-full @[460px]:w-auto @[460px]:shrink-0 @[460px]:justify-end @[460px]:text-right'
+ : 'shrink-0 justify-end text-right'
+ )}
+ >
+ {props.children}
+ </div>
+ </Show>
+ </div>
+ );
+}
+
+/**
+ * A row for an integration / service: a brand icon, a title + one-line
+ * description, and a trailing action slot. Used by the Connected accounts and
+ * MCP cards so every integration reads the same. The action stays on the
+ * title row. Description and facts use the width under the title.
+ */
+export function IntegrationRow(props: {
+ /** The brand icon, rendered at its native size inside a fixed slot. */
+ icon?: JSX.Element;
+ title: JSX.Element;
+ description?: JSX.Element;
+ /** Proven facts under the outcome. Not truncated. */
+ facts?: JSX.Element;
+ /** Optional indicator shown right after the title (e.g. a connection dot). */
+ status?: JSX.Element;
+ /** Soften title and icon when the row is paused / disabled. */
+ muted?: boolean;
+ children?: JSX.Element;
+ class?: string;
+}) {
+ return (
+ <div class={cn('flex items-start gap-4 px-6 py-5 touch:px-4', props.class)}>
+ <Show when={props.icon}>
+ <div
+ class={cn(
+ 'flex size-9 shrink-0 items-center justify-center [&_svg]:size-8 [&_img]:size-8',
+ props.muted && 'opacity-50'
+ )}
+ >
+ {props.icon}
+ </div>
+ </Show>
+ <div class="min-w-0 flex-1 flex flex-col gap-1">
+ <div class="flex min-w-0 items-center gap-3">
+ <div class="flex min-w-0 flex-1 items-center gap-2">
+ <div
+ class={cn(
+ 'text-sm font-medium truncate',
+ props.muted ? 'text-ink-muted' : 'text-ink'
+ )}
+ >
+ {props.title}
+ </div>
+ <Show when={props.status}>{props.status}</Show>
+ </div>
+ <Show when={props.children}>
+ <div class="flex shrink-0 items-center gap-2">{props.children}</div>
+ </Show>
+ </div>
+ <Show when={props.description}>
+ <div class="text-sm text-ink-muted text-balance">
+ {props.description}
+ </div>
+ </Show>
+ <Show when={props.facts}>
+ <div class="ph-no-capture text-xs text-ink-extra-muted text-balance">
+ {props.facts}
+ </div>
+ </Show>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/settings/connections/provider-meta.tsx b/apps/web/src/features/settings/connections/provider-meta.tsx
new file mode 100644
index 0000000000..203398d530
--- /dev/null
+++ b/apps/web/src/features/settings/connections/provider-meta.tsx
@@ -0,0 +1,58 @@
+import { pipedreamAppAvailableInEnv } from '@core/component/AI/constant/mcpServers';
+import GithubIcon from '@icon/mcp-github.svg';
+import LinearIcon from '@icon/mcp-linear.svg';
+import NotionIcon from '@icon/mcp-notion.svg';
+import SlackIcon from '@icon/mcp-slack.svg';
+import type { JSX } from 'solid-js';
+import { match } from 'ts-pattern';
+import type { ProviderId } from './model';
+
+export type FeaturedStarter = {
+ id: ProviderId;
+ name: string;
+ note: string;
+};
+
+export const EMPTY_STARTERS: FeaturedStarter[] = [
+ {
+ id: 'github',
+ name: 'GitHub',
+ note: 'Repos, pull requests, and issues for Macro AI',
+ },
+ {
+ id: 'linear',
+ name: 'Linear',
+ note: 'Issues for Macro AI',
+ },
+ {
+ id: 'notion',
+ name: 'Notion',
+ note: 'Search pages with Macro AI',
+ },
+ {
+ id: 'slack',
+ name: 'Slack',
+ note: 'Conversations for Macro AI',
+ },
+];
+
+export const PIPEDREAM_BROWSE_HIDDEN_SLUGS: ReadonlySet<string> = new Set([
+ ...EMPTY_STARTERS.map((item) => item.id),
+ 'cursor',
+]);
+
+export const availableStarters = () =>
+ EMPTY_STARTERS.filter((item) => pipedreamAppAvailableInEnv(item.id));
+
+export function isPipedreamBrowseHidden(appSlug: string): boolean {
+ return PIPEDREAM_BROWSE_HIDDEN_SLUGS.has(appSlug);
+}
+
+export function providerIcon(id: ProviderId): JSX.Element {
+ return match(id)
+ .with('github', () => <GithubIcon />)
+ .with('linear', () => <LinearIcon />)
+ .with('notion', () => <NotionIcon />)
+ .with('slack', () => <SlackIcon />)
+ .exhaustive();
+}
diff --git a/apps/web/src/features/settings/connections/use-connections-model.ts b/apps/web/src/features/settings/connections/use-connections-model.ts
new file mode 100644
index 0000000000..a49e16e0ac
--- /dev/null
+++ b/apps/web/src/features/settings/connections/use-connections-model.ts
@@ -0,0 +1,25 @@
+import { useMcpServersQuery } from '@queries/mcp-servers';
+import { usePipedreamConnectionsQuery } from '@queries/pipedream-connectors';
+import { createMemo } from 'solid-js';
+import { toConnectionsModel } from './model';
+
+/** Present agent tool connections independently of personal accounts and harnesses. */
+export function useConnectionsModel() {
+ const pipedream = usePipedreamConnectionsQuery();
+ const nativeMcp = useMcpServersQuery();
+ const ready = () => pipedream.isFetched && nativeMcp.isFetched;
+ const error = () => ready() && pipedream.isError && nativeMcp.isError;
+ const partialError = () =>
+ ready() && (pipedream.isError || nativeMcp.isError);
+ const retry = () => {
+ void pipedream.refetch();
+ void nativeMcp.refetch();
+ };
+ const model = createMemo(() =>
+ toConnectionsModel({
+ pipedream: pipedream.isSuccess ? (pipedream.data ?? []) : [],
+ nativeMcp: nativeMcp.isSuccess ? (nativeMcp.data ?? []) : [],
+ })
+ );
+ return { model, ready, error, partialError, retry };
+}
diff --git a/apps/web/src/features/settings/connections/view-state.tsx b/apps/web/src/features/settings/connections/view-state.tsx
new file mode 100644
index 0000000000..2f1820a885
--- /dev/null
+++ b/apps/web/src/features/settings/connections/view-state.tsx
@@ -0,0 +1,49 @@
+import {
+ createContext,
+ createSignal,
+ type ParentProps,
+ useContext,
+} from 'solid-js';
+import type { ProviderId } from './model';
+
+export type ConnectionsMode = 'connected' | 'discover';
+
+/** Navigation belongs to one mounted Agents Connections page, not global settings. */
+export function createConnectionsViewState() {
+ const [mode, setMode] = createSignal<ConnectionsMode>('connected');
+ const [provider, setProvider] = createSignal<ProviderId | null>(null);
+ return {
+ mode,
+ provider,
+ showOverview: () => {
+ setMode('connected');
+ setProvider(null);
+ },
+ showDiscover: () => {
+ setMode('discover');
+ setProvider(null);
+ },
+ openProvider: (id: ProviderId) => setProvider(id),
+ closeProvider: () => setProvider(null),
+ };
+}
+
+const ConnectionsViewContext =
+ createContext<ReturnType<typeof createConnectionsViewState>>();
+
+export function ConnectionsViewProvider(
+ props: ParentProps<{ value?: ReturnType<typeof createConnectionsViewState> }>
+) {
+ const value = props.value ?? createConnectionsViewState();
+ return (
+ <ConnectionsViewContext.Provider value={value}>
+ {props.children}
+ </ConnectionsViewContext.Provider>
+ );
+}
+
+export function useConnectionsView() {
+ const value = useContext(ConnectionsViewContext);
+ if (!value) throw new Error('ConnectionsViewProvider is required');
+ return value;
+}
diff --git a/apps/web/src/features/settings/mcp-auth-attempt.ts b/apps/web/src/features/settings/mcp-auth-attempt.ts
new file mode 100644
index 0000000000..a1dfdf48c4
--- /dev/null
+++ b/apps/web/src/features/settings/mcp-auth-attempt.ts
@@ -0,0 +1,40 @@
+const AUTH_ATTEMPT_PREFIX = 'mcp:auth-attempted:';
+
+export function mcpAuthAttemptKey(url: string): string {
+ try {
+ const parsed = new URL(url);
+ return AUTH_ATTEMPT_PREFIX + parsed.origin + parsed.pathname;
+ } catch {
+ return AUTH_ATTEMPT_PREFIX + url;
+ }
+}
+
+export function clearMcpAuthAttempts(): void {
+ try {
+ const keys: string[] = [];
+ for (let i = 0; i < localStorage.length; i++) {
+ const key = localStorage.key(i);
+ if (key?.startsWith(AUTH_ATTEMPT_PREFIX)) keys.push(key);
+ }
+ for (const key of keys) localStorage.removeItem(key);
+ } catch {
+ return;
+ }
+}
+
+export function readMcpAuthAttempted(url: string): boolean {
+ try {
+ return localStorage.getItem(mcpAuthAttemptKey(url)) === '1';
+ } catch {
+ return false;
+ }
+}
+
+export function writeMcpAuthAttempted(url: string, attempted: boolean): void {
+ try {
+ if (attempted) localStorage.setItem(mcpAuthAttemptKey(url), '1');
+ else localStorage.removeItem(mcpAuthAttemptKey(url));
+ } catch {
+ return;
+ }
+}
diff --git a/apps/web/src/features/settings/primitives.tsx b/apps/web/src/features/settings/primitives.tsx
index b41c529a8c..65ed3bc8af 100644
--- a/apps/web/src/features/settings/primitives.tsx
+++ b/apps/web/src/features/settings/primitives.tsx
@@ -26,6 +26,8 @@ export const SettingsSheetContext = createContext(false);
*/
export function SettingsPage(props: {
title: string;
+ /** Inline subpages need their own heading beneath the mobile sheet chrome. */
+ showTitleInSheet?: boolean;
/** Optional one-line subtitle; accepts text or inline markup (e.g. a link). */
description?: JSX.Element;
/** Right-aligned controls beside the title (e.g. a global toggle). */
@@ -36,7 +38,7 @@ export function SettingsPage(props: {
return (
<div
data-drawer-scroll-body={inSheet ? true : undefined}
- class="h-full min-h-0 overflow-y-auto [overflow-anchor:none] select-children"
+ class="@container/settings-page h-full min-h-0 overflow-y-auto [overflow-anchor:none] select-children"
>
{/* On mobile/tablet the page is full-frame: the chrome insets live inside the
scroll content (plus the usual breathing room) so pages scroll under
@@ -46,7 +48,7 @@ export function SettingsPage(props: {
'mx-auto w-full max-w-[710px]',
inSheet
? '@container px-3 pt-2 pb-[max(24px,var(--mobile-sheet-safe-padding))]'
- : 'px-10 pt-14 pb-24 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]'
+ : 'px-10 pt-14 pb-24 @max-[480px]/settings-page:px-4 @max-[480px]/settings-page:pt-6 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]'
)}
>
{/* Headers are inset by the card's inner padding so the title and
@@ -54,12 +56,12 @@ export function SettingsPage(props: {
while the cards themselves stay full-width. */}
<header
class={cn(
- 'flex items-start justify-between gap-4',
+ 'flex items-start justify-between gap-4 @max-[480px]/settings-page:flex-col @max-[480px]/settings-page:gap-3',
inSheet ? 'px-4' : 'px-6'
)}
>
<div class="flex flex-col gap-1.5 min-w-0">
- <Show when={!inSheet}>
+ <Show when={!inSheet || props.showTitleInSheet}>
<h1 class="text-2xl/tight font-semibold text-ink">
{props.title}
</h1>
diff --git a/apps/web/src/features/settings/tests/select-helpers.ts b/apps/web/src/features/settings/tests/select-helpers.ts
new file mode 100644
index 0000000000..0d95e89f16
--- /dev/null
+++ b/apps/web/src/features/settings/tests/select-helpers.ts
@@ -0,0 +1,22 @@
+import { fireEvent, screen, within } from '@solidjs/testing-library';
+
+function openSelect(trigger: HTMLElement) {
+ fireEvent.keyDown(trigger, { key: 'ArrowDown' });
+ const listbox = screen
+ .getAllByRole('listbox')
+ .find((element) => element.getAttribute('aria-labelledby') === trigger.id);
+ if (!listbox) throw new Error('No listbox labelled by the select trigger');
+ return listbox;
+}
+
+/** Inspect the portalled options, then close the menu without changing it. */
+export function selectOptions(trigger: HTMLElement) {
+ const listbox = openSelect(trigger);
+ fireEvent.keyDown(listbox, { key: 'Escape' });
+ return within(listbox);
+}
+
+export function chooseSelectOption(trigger: HTMLElement, name: string) {
+ const listbox = openSelect(trigger);
+ fireEvent.click(within(listbox).getByRole('option', { name }));
+}
diff --git a/apps/web/src/lib/core/auth/logout.ts b/apps/web/src/lib/core/auth/logout.ts
index 58d4e5ea1c..389826def5 100644
--- a/apps/web/src/lib/core/auth/logout.ts
+++ b/apps/web/src/lib/core/auth/logout.ts
@@ -1,3 +1,4 @@
+import { clearMcpAuthAttempts } from '@app/features/settings/mcp-auth-attempt';
import { useAnalytics } from '@app/lib/analytics/analytics-context';
import { SERVER_HOSTS } from '@core/constant/servers';
import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
@@ -45,6 +46,7 @@ export async function clearLocalAuthSession() {
// Queued mutations are user intent; never allow them to replay under a
// subsequent account sharing this anonymous device cache scope.
await Promise.all([documentContextsCleared, clearRegisteredCaches()]);
+ clearMcpAuthAttempts();
}
export function useLogout() {
diff --git a/apps/web/src/lib/core/component/AI/component/input/ModelCatalogPicker.tsx b/apps/web/src/lib/core/component/AI/component/input/ModelCatalogPicker.tsx
index 7535edf2f3..d96a7904c1 100644
--- a/apps/web/src/lib/core/component/AI/component/input/ModelCatalogPicker.tsx
+++ b/apps/web/src/lib/core/component/AI/component/input/ModelCatalogPicker.tsx
@@ -94,7 +94,7 @@ export function ModelCatalogPicker(props: ModelCatalogPickerProps) {
disabled={props.disabled || props.pending}
>
<ModelIcon model={props.value} />
- <span class="min-w-0 truncate">
+ <span class="min-w-0 flex-1 truncate text-left">
{props.triggerLabel ?? displayValue()}
</span>
<CaretDown class="size-3.5 shrink-0 rotate-[-90deg] opacity-70" />
diff --git a/apps/web/src/lib/core/constant/settingsTabsConfig.tsx b/apps/web/src/lib/core/constant/settingsTabsConfig.tsx
index 4dab62fca4..d85420ab58 100644
--- a/apps/web/src/lib/core/constant/settingsTabsConfig.tsx
+++ b/apps/web/src/lib/core/constant/settingsTabsConfig.tsx
@@ -5,7 +5,6 @@ import BuildingsIcon from '@phosphor/buildings.svg';
import CpuIcon from '@phosphor/cpu.svg';
import CreditCardIcon from '@phosphor/credit-card.svg';
import DeviceMobileIcon from '@phosphor/device-mobile-speaker.svg';
-import HardDrivesIcon from '@phosphor/hard-drives.svg';
import KeyIcon from '@phosphor/key.svg';
import KeyboardIcon from '@phosphor/keyboard.svg';
import PlugIcon from '@phosphor/plug.svg';
@@ -58,6 +57,7 @@ export const SETTINGS_TAB_GROUPS: SettingsTabGroup[] = [
{ tab: 'Notifications', label: 'Notifications', icon: BellIcon },
{ tab: 'Billing', label: 'Billing', icon: CreditCardIcon },
{ tab: 'Appearance', label: 'Appearance', icon: SwatchesIcon },
+ { tab: 'Agents', label: 'Agents', icon: AgentIcon },
{ tab: 'Mobile App', label: 'Mobile App', icon: DeviceMobileIcon },
{ tab: 'Shortcuts', label: 'Shortcuts', icon: KeyboardIcon },
],
@@ -77,13 +77,6 @@ export const SETTINGS_TAB_GROUPS: SettingsTabGroup[] = [
{ tab: 'Bots', label: 'Bots', icon: BotIcon },
],
},
- {
- label: 'Agents',
- items: [
- { tab: 'Agents', label: 'Agents', icon: AgentIcon },
- { tab: 'Harness', label: 'Harness', icon: HardDrivesIcon },
- ],
- },
{
label: 'Admin',
items: [{ tab: 'Admin', label: 'Debug', icon: BugIcon }],
@@ -114,7 +107,7 @@ const SETTINGS_TAB_SLUGS: Record<SettingsTab, string> = {
'Mobile App': 'mobile-app',
Agent: 'mcp-server',
Agents: 'agents',
- Harness: 'harness',
+ Harness: 'runtimes',
Bots: 'bots',
Team: 'team',
Tags: 'tags',
@@ -131,6 +124,9 @@ const SETTINGS_SLUG_TO_TAB = new Map<string, SettingsTab>(
)
);
+// Preserve daemon pairing links and bookmarks from before the rename.
+SETTINGS_SLUG_TO_TAB.set('harness', 'Harness');
+
/** The URL slug for a settings tab (e.g. `Connected` → `connections`). */
export const settingsTabToSlug = (tab: SettingsTab): string =>
SETTINGS_TAB_SLUGS[tab];
@@ -149,7 +145,9 @@ export const settingsSlugToTab = (
export const getSettingsTabItem = (
tab: SettingsTab
): SettingsTabItem | undefined =>
- SETTINGS_TAB_ITEMS.find((item) => item.tab === tab);
+ tab === 'Harness'
+ ? { tab: 'Harness', label: 'Agents', icon: AgentIcon }
+ : SETTINGS_TAB_ITEMS.find((item) => item.tab === tab);
/**
* Returns a predicate gating which settings tabs are available given feature
diff --git a/apps/web/src/lib/core/pipedream/catalog.ts b/apps/web/src/lib/core/pipedream/catalog.ts
index ba75e5b600..362527f6c0 100644
--- a/apps/web/src/lib/core/pipedream/catalog.ts
+++ b/apps/web/src/lib/core/pipedream/catalog.ts
@@ -37,14 +37,16 @@ export function createPipedreamCatalogSearch(
const query = usePipedreamCatalogQuery(search);
- const entries = (): PipedreamCatalogEntryResponse[] =>
- (query.data?.pages ?? [])
+ const entries = (): PipedreamCatalogEntryResponse[] => {
+ if (!query.isSuccess) return [];
+ return (query.data?.pages ?? [])
.flatMap((page) => page.servers)
.filter(
(entry) =>
pipedreamAppAvailableInEnv(entry.app_slug) &&
!exclude().has(entry.app_slug)
);
+ };
return { searchInput, onSearchInput, search, query, entries };
}
diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.md
index 52fb7e1f4f..0c95931436 100644
--- a/docs/AGENT_GUIDE/ai-chat.md
+++ b/docs/AGENT_GUIDE/ai-chat.md
@@ -77,7 +77,7 @@ permission failures should display a failed tool call without a successful resul
Clicking an agent directly uses its default; choosing a submenu model selects
both the agent and that model. A checkmark identifies the selected model,
including when it is the agent’s configured default; there is no separate default row.
- Disconnected Cursor offers **Connect Cursor**, opening Settings → Harness.
+ Disconnected Cursor offers **Connect Cursor**, opening Settings → Agents → Runtimes.
The built-in sandbox and paired macrod runtimes are not offered here.
- Selecting an agent changes the heading: **What should we work on?** for chat
agents and **What should we build?** for coding agents. The draft stays intact
@@ -137,11 +137,25 @@ permission failures should display a failed tool call without a successful resul
its mode and conversation. Newly created sessions replace their temporary
URL with the real id without remounting the composer or adding a temporary
history step.
-- **Agents page** (inside the workspace; Settings → Agents is unchanged):
- **Close** returns to the composer. **Agents / Coding agents** tabs split
- the roster into Team and Private, with Edit / Delete actions. The coding
- tab includes runtime setup. The create/edit dialog has sharing, name,
- `@tag`, runtime, default model, connections, channels, and instructions.
+- **Agents page** uses the same **Agents** management screen as Settings.
+ **Agents** lists Team and Private agents with Edit / Delete actions; **Runtimes**
+ configures built-in providers and paired machines. **New agent** and **New runtime**
+ replace the list with full-page forms, not dialogs. Back/Cancel returns to the list;
+ use **New conversation** in the sidebar to return to the composer. The animated
+ **Bring your own agent** card appears only in **Runtimes**, below the tabs and
+ above the runtime lists. It links directly to runtime pairing and its setup guide.
+ The **Paired runtimes** section appears once you have a paired runtime; an empty
+ list does not repeat the pairing action from **Bring your own agent**.
+ **New runtime** shows three steps: install macrod from the linked release,
+ run `./macrod` and configure your agent in Quickstart, then enter your pairing
+ code and click **Look up**. Review the request and click **Approve** to connect.
+ The setup guide contains configuration and pairing screenshots in that order.
+ Enter the code from your own terminal, not the example screenshot.
+ The agent form retains sharing, name, `@tag`, runtime, default model, connections,
+ channels, instructions, and permission policy.
+ Runtime and short model lists use styled dropdown buttons: open the field and
+ choose an option (or use arrow keys and Enter). Escape dismisses the menu.
+ Large model lists retain the searchable model picker.
- **Session**: the header has the sidebar reopen control, a linked PR status chip,
favorite, Share, and Side panel. The top-left title uses the same provider icon,
saved-title precedence, and title menu as `/app/agent/<id>`; click the caret
@@ -514,7 +528,7 @@ There is no breadcrumb because Agents has no subspaces. Unknown model providers
fall back to the chat icon. The toggle (or `]`) opens the session's Details, Plan,
Changes, Activity, and References sections when available, beside the transcript in wide
layouts or over it in narrow layouts; it does not open another split.
-Details lists Status, Agent, Model, and dates for every session; the Harness
+Details lists Status, Agent, Model, and dates for every session; the Runtime
row appears only for coding runtimes, never for in-memory chat agents.
`References` is the same section documents show: one row per channel message that
`@`-mentioned or shared the session (sender, channel chip, time, and a two-line
@@ -717,13 +731,13 @@ must stay hidden; subsequent live messages must still appear.
Several permissions may be pending alongside one question; answering one leaves
the others available. Controls disappear when their turn ends, is stopped, or
disconnects, and old transcript requests cannot answer a later turn's request.
-- **Harness bypass consent.** Settings → Harnesses → Connect a harness offers
+- **Runtime bypass consent.** Settings → Agents → Runtimes → New runtime offers
`Allow bypassing permission requests`, off by default. Enabling it warns that
agents may run commands and edit files on the machine without approval.
Macrod Quickstart and Config also offer `Full Access`, off by
default. The choice applies at the next pairing: off disables bypass in the
- approval dialog; on preselects bypass with a warning, and the approving user
- can turn it off. Older daemons leave this choice to the approval dialog.
+ pairing page; on preselects bypass with a warning, and the approving user
+ can turn it off. Older daemons leave this choice to the pairing page.
- **Agent permission policy.** Settings → Agents → Runtime shows `Always prompt`
and `Always bypass` only for local macrod harnesses. Macrod defaults to prompts;
bypass requires both harness consent and the agent's explicit choice. Built-in
diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.md
index 161aee93f5..4d92601f76 100644
--- a/docs/AGENT_GUIDE/channels.md
+++ b/docs/AGENT_GUIDE/channels.md
@@ -157,7 +157,7 @@ opens the session.
regardless of which harness they use.
A mention without a connected account creates no session and replies in the thread
with a **Connect Cursor**, **Connect Codex**, or **Connect Claude** chip. Each chip
-opens Settings → Harness, where all three connection cards are visible. The same
+opens Settings → Agents → Runtimes, where all three connection cards are visible. The same
chip reads **connected** after setup; mention the bot again to start a session.
Codex also prompts for a cloud environment when ChatGPT is connected but no
environment has been saved. New sessions use that environment on
@@ -171,7 +171,7 @@ a configured backend for end-to-end verification.
Within the Cursor rollout, `@cursor` is offered whether connected or not. A mention from someone with
no Cursor API key opens no session: the Cursor bot replies in the thread that
`@cursor` runs on their own account and is not connected yet, followed by a
-**Connect Cursor** chip. Clicking the chip opens Settings → Harness; once a key
+**Connect Cursor** chip. Clicking the chip opens Settings → Agents → Runtimes; once a key
is saved the same chip reads **Cursor connected** and stops navigating. The
original mention is not replayed - mention `@cursor` again after connecting.
diff --git a/docs/AGENT_GUIDE/navigation.md b/docs/AGENT_GUIDE/navigation.md
index ee35a95924..feef34c4ba 100644
--- a/docs/AGENT_GUIDE/navigation.md
+++ b/docs/AGENT_GUIDE/navigation.md
@@ -421,13 +421,13 @@ Shared Mail restart rules still apply.
- In any text surface: `@` mentions (bidirectional links), `#` tags, `/` block commands,
`:` emoji. Clicking a rendered tag opens a Search split filtered to that tag.
-Settings → Agents and Settings → Harness render while their requests are pending.
+Settings → Agents → Agents / Runtimes render while their requests are pending.
A pending Cursor model catalog shows `Loading models…` beside a disabled model
picker; a failed catalog shows an inline error. The rest of settings stays usable.
With the `claude-cloud` feature flag enabled, Claude Cloud connection setup is in
-Settings → Harness, above Cursor, with the
-Anthropic logo. Settings → Agents selects an agent's harness but does not host
+Settings → Agents → Runtimes, above Cursor, with the
+Anthropic logo. Settings → Agents → Agents selects an agent's runtime but does not host
Claude's connection form. **Connect Claude** starts authorization and opens sign-in
on the first click; a fallback link remains if the browser blocks the tab.
Approve on Claude's page, copy the complete `code#state`, then use **Finish
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index 12ef7cff21..c6ad4ef037 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -862,6 +862,17 @@ and prevent dismissal; canceling leaves the underlying data unchanged.
## Settings — `/app/settings/<section>`
+### Email signatures
+
+In Integrations, **Edit signature** beside an owned inbox expands its editor.
+The editor uses the app's background and text colors, including in dark mode;
+explicit colors in signature content are preserved. **Close signature editor**
+(the X) or Escape while focused in that inbox row collapses it and returns focus
+to **Edit signature**. Unsaved edits remain when reopened; closing does not save
+or remove the signature.
+The inbox row's trash icon removes the inbox through the existing confirmation;
+it is separate from the signature editor's close control.
+
### Team membership
Team membership has no size cap, including free teams. Invitations and domain
@@ -895,28 +906,51 @@ and split navigation.
Left nav: General → `Account` (profile, delete account), `API Keys` (create /
list / delete personal keys; the secret is shown only once and is sent as
`x-macro-user-api-key`), `Notifications`, `Billing`,
-`Appearance`, `Mobile App`, `Shortcuts` (interactive keyboard visualization, not a list);
+`Appearance`, `Agents`, `Mobile App`, `Shortcuts` (interactive keyboard visualization, not a list);
Workspace → `Team`, `Tags`, `CRM` (enable/disable; once enabled, a `Deal stages` section
with `Customize stages`, inline rename, reorder by drag handle or arrow keys (up/down
buttons on touch), delete, `Add stage`, `Reset to defaults`, and `Closed stages`
checkboxes, editable by the role set as `edit_stages_role`),
`Integrations` (personal Gmail/GitHub accounts), `MCP server`
-(setup snippets for Claude Code / Codex CLI / Claude.ai / ChatGPT / IDE), `Agents`, `Bots`, `Harness`;
+(setup snippets for Claude Code / Codex CLI / Claude.ai / ChatGPT / IDE), `Bots`;
`Log out`.
-`Agents` lists team and private agents with `Create agent` / `Edit <name>` dialogs grouped
+`Agents` unifies agent definitions and runtime configuration in one page, also used by the Agents workspace. Its `Agents` section lists team and private agents. `New agent` / `Edit <name>` open full-page forms grouped
Profile, Behavior, Runtime, Connections, Channels, Share. Connections is a radio pair:
`Use my connected apps` (default; the agent gets whatever the person running it has
connected) or `Specific apps`, which reveals a `Search connectors` box over the whole
Pipedream catalog (results are `option` rows; picking one adds it) and a row per picked app
with a connected / not-connected dot for the *current viewer* plus an inline `Connect`
-that opens the Pipedream Connect flow inside the dialog. Unconnected picks never block
+that opens the Pipedream Connect flow inside the page. Unconnected picks never block
saving; each teammate connects their own account. An agent session that calls a picked
but unconnected app gets a tool result saying so, and the agent's reply renders a
`Connect <app>` chip that opens Agents → Connections for that app. MCP integrations
are managed on that page, rather than in Settings.
+
+With `pipedream-mcp` enabled, Agents → Connections has `Connected` and `Discover`
+tabs. Connected groups GitHub, Linear, Notion, and Slack tool grants by provider,
+lists other catalog connections alongside them, and puts custom MCP servers in
+a separate section. Discover offers featured providers, a searchable catalog,
+and `Add custom MCP`. Slack discovery retains its development-only gate.
+Provider Back returns to the tab that opened it; navigation is local to each
+Agents workspace and starts at Connected on a fresh visit.
+Provider and custom-server More menus contain Disable, Reconnect, and Disconnect;
+custom servers also offer Rename. Disabled grants show Enable. Unauthenticated
+custom servers show Connect and Remove. Disconnect/Remove require confirmation.
+Adding a custom MCP saves its name and URL; Connect on its row starts OAuth.
+An agent reply's `Connect <app>` chip still starts that app's connection flow.
+Cursor stays in Agents → Runtimes with its API key and default model controls; it is not
+featured or offered in the Connections catalog. Personal Gmail and GitHub account
+links remain in Settings → Integrations. The native-only Connections page remains
+available when `pipedream-mcp` is disabled.
`Back to app` returns to the previous surface. Open via user-email button menu or `Ctrl+;`.
-`Agents` → `Create agent` (or edit an existing agent) opens runtime selectors.
+`Agents` → `New agent` (or edit an existing agent) opens a full-page form. The
+`Instructions` field is a Lexical contenteditable textbox, not a textarea. It
+supports Markdown headings, lists, emphasis, code, links, and the normal `@`
+mention picker; select text to open the formatting menu. Saved instructions
+retain mention identities using the shared editor's Markdown format and reopen
+with their formatting intact. Enter adds a new paragraph; use `Create agent` or
+`Save changes` to submit. The form also includes runtime selectors.
The model list is loaded live and independently for Macro Agent, connected Cursor, and every
registered macrod harness. The selected harness stays selected when the list refreshes.
A paired macrod connects on startup, so models can load before any agents are bound.
@@ -928,7 +962,7 @@ New macrod sessions use the agent's saved model before sending the first prompt.
Changing that default applies to new sessions; existing sessions keep their selected model.
If the runtime rejects the saved model, the prompt fails instead of using a different model.
-`Harness` shows Cursor, Claude, Codex, and paired macrod runtimes to every user.
+The `Runtimes` section shows built-in Macro, Cursor, Claude, and Codex configuration, followed by paired macrod runtimes. The “Bring your own agent” card sits above the Agents / Runtimes navigation and is visible on both sections. It rotates Claude Code, OpenCode, OpenClaw, and Hermes; reduced motion keeps a static name. Its `New runtime` action opens the full-page pairing flow from either section: enter the code, look up the request, review the machine, name, sharing and permission consent, then Approve and Done. Back/Cancel returns to the runtime list. Destructive removal still requires confirmation. `/settings/runtimes` opens this section; legacy `/settings/harness?pair=…` links remain supported.
Connection chips in agent replies open this page, including before any account is connected. Cursor's default-model picker uses
the same live model discovery and retains its existing save action.
@@ -943,7 +977,11 @@ picker or automatic repository selection. Changed selections display **Unsaved
changes** until the server confirms them. The save button is disabled until an
environment is selected, and when it matches the saved environment.
These choices apply to new sessions. **Disconnect** in the Codex row (accessible
-name **Disconnect ChatGPT**) removes the connection. The UI never asks for an
+name **Disconnect ChatGPT**) asks for confirmation before removing the connection.
+Claude, Cursor, and Connections disconnect actions use the same shared confirmation
+dialog (a drawer on mobile); Cancel leaves the connection intact. Claude's row
+keeps its layout while status loads, and sign-in details appear only after Connect.
+The UI never asks for an
OAuth token.
The Codex section and its auth/config requests were exercised in Chromium with