Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(desktop): set up local agents in place and run them with the shell environment (#9456)
Eric Hayes96beaaa8658c
diff --git a/apps/web/src/features/local-runtime/views/local-runtime-setup-panel.test.tsx b/apps/web/src/features/local-runtime/views/local-runtime-setup-panel.test.tsxindex f16a77b3e3..dc37bbf464 100644--- a/apps/web/src/features/local-runtime/views/local-runtime-setup-panel.test.tsx+++ b/apps/web/src/features/local-runtime/views/local-runtime-setup-panel.test.tsx@@ -100,6 +100,34 @@ describe('LocalRuntimeSetupPanel', () => {expect(await screen.findByText('@claude-code is ready')).toBeTruthy();});+ it('does not start setup when closed while it is still looking for agents', async () => {+ let finishScan: () => void = () => {};+ const scanned = new Promise<void>((resolve) => {+ finishScan = resolve;+ });+ const startDaemon = vi.fn(async () => RUNNING);+ const base = capabilities({ startDaemon });+ const view = render(() => (+ <LocalRuntimeSetupPanel+ capabilities={{+ ...base,+ detectAgents: async () => {+ await scanned;+ return base.detectAgents();+ },+ }}+ onOpenSession={() => {}}+ autoStart+ />+ ));++ view.unmount();+ finishScan();+ await scanned;+ await new Promise((resolve) => setTimeout(resolve, 0));+ expect(startDaemon).not.toHaveBeenCalled();+ });+it('asks to install an agent when none is found', async () => {render(() => (<LocalRuntimeSetupPaneldiff --git a/apps/web/src/features/local-runtime/views/local-runtime-setup-panel.tsx b/apps/web/src/features/local-runtime/views/local-runtime-setup-panel.tsxindex ef273d3225..57c7793a1a 100644--- a/apps/web/src/features/local-runtime/views/local-runtime-setup-panel.tsx+++ b/apps/web/src/features/local-runtime/views/local-runtime-setup-panel.tsx@@ -6,7 +6,14 @@ import CheckCircleIcon from '@icon/system/regular/check-circle.svg';import SpinnerIcon from '@icon/system/regular/spinner-gap.svg';import type { MacrodStatus } from '@macro/tauri/macrod';import { Button, cn, ToggleSwitch } from '@ui';-import { createSignal, Match, onMount, Show, Switch } from 'solid-js';+import {+ createSignal,+ Match,+ onCleanup,+ onMount,+ Show,+ Switch,+} from 'solid-js';import { match } from 'ts-pattern';import {type ChecklistStep,@@ -73,9 +80,15 @@ export function LocalRuntimeSetupPanel(props: {start();return;}+ // Closing the panel mid-scan must not start setup behind the user's back.+ let disposed = false;+ onCleanup(() => {+ disposed = true;+ });fireAndForget((async () => {await setup.scan();+ if (disposed) return;if (props.autoStart && (setup.agents()?.length ?? 0) > 0) start();})(),'local-runtime-setup'diff --git a/apps/web/src/features/settings/components/local-runtime-prompt.test.tsx b/apps/web/src/features/settings/components/local-runtime-prompt.test.tsxindex d6af3daff4..efdd5086c2 100644--- a/apps/web/src/features/settings/components/local-runtime-prompt.test.tsx+++ b/apps/web/src/features/settings/components/local-runtime-prompt.test.tsx@@ -7,7 +7,7 @@ import {screen,waitFor,} from '@solidjs/testing-library';-import { createSignal } from 'solid-js';+import { createSignal, type JSX, Show } from 'solid-js';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { LocalRuntimePrompt } from './local-runtime-prompt';@@ -18,7 +18,9 @@ const mocks = vi.hoisted(() => ({statusPhase: 'stopped',inspect: undefined as Promise<{ paired: boolean }> | undefined,listen: undefined as Promise<() => void> | undefined,- openSettings: vi.fn(),+ setupProps: undefined as+ | { defaultWorkspace?: string; autoStart?: boolean }+ | undefined,onStatus: undefined as ((status: { phase: string }) => void) | undefined,unlisten: vi.fn(),}));@@ -26,13 +28,32 @@ const mocks = vi.hoisted(() => ({vi.mock('@core/util/platform', () => ({isDesktopPlatform: () => mocks.desktop,}));-vi.mock('@core/constant/SettingsState', () => ({- useSettingsState: () => ({ openSettings: mocks.openSettings }),+vi.mock('@app/features/local-runtime/views/local-runtime-setup-dialog', () => ({+ LocalRuntimeSetupDialog: (props: {+ open: boolean;+ children: JSX.Element;+ }) => (+ <Show when={props.open}>+ <div role="dialog">{props.children}</div>+ </Show>+ ),+}));+vi.mock('@app/features/local-runtime/local-runtime-setup', () => ({+ LocalRuntimeSetup: (props: {+ defaultWorkspace?: string;+ autoStart?: boolean;+ }) => {+ mocks.setupProps = props;+ return <div>Local setup</div>;+ },}));let currentUser: () => string | undefined = () => 'user-1';vi.mock('@core/context/user', () => ({ useUserId: () => currentUser }));vi.mock('@macro/tauri/macrod', () => ({- macrodSupport: async () => ({ supported: mocks.supported }),+ macrodSupport: async () => ({+ supported: mocks.supported,+ defaultWorkspace: '/Users/me/Macro',+ }),macrodInspect: () =>mocks.inspect ?? Promise.resolve({ paired: mocks.paired }),macrodStatus: async () => ({ phase: mocks.statusPhase }),@@ -49,7 +70,7 @@ beforeEach(() => {mocks.statusPhase = 'stopped';mocks.inspect = undefined;mocks.listen = undefined;- mocks.openSettings.mockClear();+ mocks.setupProps = undefined;mocks.unlisten.mockClear();mocks.onStatus = undefined;currentUser = () => 'user-1';@@ -60,7 +81,7 @@ afterEach(() => {});describe('local runtime invitation', () => {- it('opens local setup from both mounted composer prompts and dismisses both on this computer', async () => {+ it('sets up in place from both mounted composer prompts and dismisses both on this computer', async () => {render(() => (<><LocalRuntimePrompt />@@ -74,7 +95,11 @@ describe('local runtime invitation', () => {);fireEvent.click(screen.getAllByText('Set up')[0]);- expect(mocks.openSettings).toHaveBeenCalledWith('Harness');+ expect(await screen.findByText('Local setup')).toBeTruthy();+ expect(mocks.setupProps).toMatchObject({+ defaultWorkspace: '/Users/me/Macro',+ autoStart: true,+ });fireEvent.click(screen.getAllByRole('button', {diff --git a/apps/web/src/features/settings/components/local-runtime-prompt.tsx b/apps/web/src/features/settings/components/local-runtime-prompt.tsxindex f4c253d99c..458931ef6a 100644--- a/apps/web/src/features/settings/components/local-runtime-prompt.tsx+++ b/apps/web/src/features/settings/components/local-runtime-prompt.tsx@@ -1,6 +1,7 @@-import { useSettingsState } from '@core/constant/SettingsState';+import { LocalRuntimeSetupDialog } from '@app/features/local-runtime/views/local-runtime-setup-dialog';import { useUserId } from '@core/context/user';import { fireAndForget } from '@core/util/fireAndForget';+import { lazyNamed } from '@core/util/lazyNamed';import { isDesktopPlatform } from '@core/util/platform';import { createUserScopedStorage } from '@core/util/userScopedStorage';import {@@ -12,20 +13,29 @@ import {import LaptopIcon from '@phosphor/laptop.svg';import XIcon from '@phosphor/x.svg';import type { UnlistenFn } from '@tauri-apps/api/event';-import { createSignal, onCleanup, onMount, Show } from 'solid-js';+import { createSignal, onCleanup, onMount, Show, Suspense } from 'solid-js';++const LocalRuntimeSetup = lazyNamed(+ () => import('@app/features/local-runtime/local-runtime-setup'),+ 'LocalRuntimeSetup'+);const dismissal = createUserScopedStorage('macro:local-runtime-prompt:dismissed');const dismissalEvent = 'macro:local-runtime-prompt:dismissed';-/** Invite each desktop installation to set up its own bundled local runtime. */+/**+ * Invite each desktop installation to set up its own bundled local runtime,+ * and run that setup in place.+ */export function LocalRuntimePrompt() {if (!isDesktopPlatform()) return null;const userId = useUserId();- const { openSettings } = useSettingsState();const [available, setAvailable] = createSignal(false);+ const [setupOpen, setSetupOpen] = createSignal(false);+ const [defaultWorkspace, setDefaultWorkspace] = createSignal<string>();const [dismissalVersion, setDismissalVersion] = createSignal(0);const refreshDismissal = () => {@@ -69,6 +79,7 @@ export function LocalRuntimePrompt() {try {const support = await macrodSupport();if (!support.supported || disposed) return;+ setDefaultWorkspace(support.defaultWorkspace ?? undefined);fireAndForget(refresh(), 'local-runtime-prompt.refresh');fireAndForget((async () => {@@ -112,33 +123,53 @@ export function LocalRuntimePrompt() {};return (- <Show when={available() && !dismissed()}>- <div class="mb-3 flex items-center gap-1 rounded-xl border border-edge-muted bg-surface p-1.5 text-ink">- <button- type="button"- class="flex min-w-0 flex-1 items-center gap-3 rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"- onClick={() => openSettings('Harness')}- >- <LaptopIcon class="size-5 shrink-0 text-accent" aria-hidden="true" />- <span class="min-w-0 flex-1">- <span class="block text-sm font-medium">- Run agents on this computer- </span>- <span class="block text-xs text-ink-muted">- Use your installed agents and local files in Macro.+ <>+ <Show when={available() && !dismissed()}>+ <div class="mb-3 flex items-center gap-1 rounded-xl border border-edge-muted bg-surface p-1.5 text-ink">+ <button+ type="button"+ class="flex min-w-0 flex-1 items-center gap-3 rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"+ onClick={() => setSetupOpen(true)}+ >+ <LaptopIcon+ class="size-5 shrink-0 text-accent"+ aria-hidden="true"+ />+ <span class="min-w-0 flex-1">+ <span class="block text-sm font-medium">+ Run agents on this computer+ </span>+ <span class="block text-xs text-ink-muted">+ Use your installed agents and local files in Macro.+ </span></span>- </span>- <span class="shrink-0 text-xs font-medium text-accent">Set up</span>- </button>- <button- type="button"- class="flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-muted hover:bg-hover hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"- aria-label="Dismiss Run agents on this computer"- onClick={dismiss}- >- <XIcon class="size-4" aria-hidden="true" />- </button>- </div>- </Show>+ <span class="shrink-0 text-xs font-medium text-accent">Set up</span>+ </button>+ <button+ type="button"+ class="flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-muted hover:bg-hover hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"+ aria-label="Dismiss Run agents on this computer"+ onClick={dismiss}+ >+ <XIcon class="size-4" aria-hidden="true" />+ </button>+ </div>+ </Show>+ {/* Outside the invitation, which hides once the runtime starts mid-setup. */}+ <LocalRuntimeSetupDialog+ open={setupOpen()}+ onClose={() => setSetupOpen(false)}+ >+ <Show when={setupOpen()}>+ <Suspense>+ <LocalRuntimeSetup+ defaultWorkspace={defaultWorkspace()}+ autoStart+ onClose={() => setSetupOpen(false)}+ />+ </Suspense>+ </Show>+ </LocalRuntimeSetupDialog>+ </>);}diff --git a/apps/web/tauri/src-tauri/src/desktop/macrod.rs b/apps/web/tauri/src-tauri/src/desktop/macrod.rsindex a29e4c5167..ac0b803487 100644--- a/apps/web/tauri/src-tauri/src/desktop/macrod.rs+++ b/apps/web/tauri/src-tauri/src/desktop/macrod.rs@@ -13,10 +13,11 @@//! stops it, and app launch resumes any configured daemon the user has not//! stopped.//!-//! GUI apps on macOS inherit launchd's minimal `PATH`, where user-installed-//! CLIs (`claude`, `codex`, `npm`) are invisible. Every macrod invocation runs-//! with the user's login-shell `PATH` so detection matches what a terminal-//! would see.+//! GUI apps on macOS inherit launchd's minimal environment, where+//! user-installed CLIs (`claude`, `codex`, `npm`) and the credentials and+//! config their shells export are invisible. Every macrod invocation runs with+//! the user's interactive login-shell environment, so detection and agent+//! authentication match what a terminal would see.use std::path::PathBuf;use std::process::Stdio;@@ -147,37 +148,125 @@ fn emit_status(app: &AppHandle, status: &MacrodStatus) {}}-/// The user's login-shell `PATH`, resolved once. `None` when it cannot be-/// read (non-unix, odd shells); callers fall back to the process `PATH`.-fn login_shell_path() -> Option<&'static str> {- static RESOLVED: OnceLock<Option<String>> = OnceLock::new();- RESOLVED- .get_or_init(|| {- #[cfg(unix)]- {- let shell = std::env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_owned());- // `env` output is shell-agnostic (fish would join "$PATH" with- // spaces); take the last PATH= line in case a login banner- // happens to contain one.- let output = std::process::Command::new(&shell)- .args(["-l", "-c", "env"])- .stdin(Stdio::null())- .output()- .ok()?;- let stdout = String::from_utf8_lossy(&output.stdout);- stdout- .lines()- .rev()- .find_map(|line| line.strip_prefix("PATH="))- .map(str::to_owned)- .filter(|path| !path.is_empty())+/// Brackets the shell's `env` output, so rc-file banners are never parsed.+#[cfg(any(unix, test))]+const ENV_START: &str = "__MACRO_SHELL_ENV_START__";+#[cfg(any(unix, test))]+const ENV_END: &str = "__MACRO_SHELL_ENV_END__";++/// How long an interactive login shell may take to print its environment.+#[cfg(unix)]+const SHELL_ENV_TIMEOUT: Duration = Duration::from_secs(5);++/// Shell bookkeeping that describes the probe shell, not the user's setup.+const SHELL_ONLY_VARS: [&str; 5] = ["_", "SHLVL", "PWD", "OLDPWD", "PATH"];++/// The environment of the user's interactive login shell, resolved once:+/// what a terminal sees, including variables exported from `.zshrc` or+/// `.bashrc` that a non-interactive login shell skips. Agents read their+/// credentials and config from there (`CLAUDE_CODE_OAUTH_TOKEN`,+/// `CLAUDE_CONFIG_DIR`, `ANTHROPIC_API_KEY`, ...); without them Claude Code+/// falls back to stale stored credentials and fails to authenticate. Empty+/// when it cannot be read (non-unix, odd shells, a hung rc file).+fn login_shell_env() -> &'static [(String, String)] {+ static RESOLVED: OnceLock<Vec<(String, String)>> = OnceLock::new();+ RESOLVED.get_or_init(|| {+ #[cfg(unix)]+ {+ read_login_shell_env().unwrap_or_default()+ }+ #[cfg(not(unix))]+ {+ Vec::new()+ }+ })+}++#[cfg(unix)]+fn read_login_shell_env() -> Option<Vec<(String, String)>> {+ use std::io::Read as _;++ let shell = std::env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_owned());+ // `env` output is shell-agnostic (fish would join "$PATH" with spaces).+ let script = format!("echo {ENV_START}; env; echo {ENV_END}");+ let mut child = std::process::Command::new(&shell)+ .args(["-i", "-l", "-c", &script])+ .stdin(Stdio::null())+ .stdout(Stdio::piped())+ .stderr(Stdio::null())+ .spawn()+ .ok()?;+ let mut stdout = child.stdout.take()?;+ let reader = std::thread::spawn(move || {+ let mut bytes = Vec::new();+ let _ = stdout.read_to_end(&mut bytes);+ bytes+ });+ let deadline = std::time::Instant::now() + SHELL_ENV_TIMEOUT;+ loop {+ match child.try_wait() {+ Ok(Some(_)) => break,+ Ok(None) if std::time::Instant::now() < deadline => {+ std::thread::sleep(Duration::from_millis(20));}- #[cfg(not(unix))]- {- None+ _ => {+ tracing::warn!(shell, "login shell environment timed out");+ let _ = child.kill();+ let _ = child.wait();+ return None;}- })- .as_deref()+ }+ }+ let bytes = reader.join().ok()?;+ let vars = parse_shell_env(&String::from_utf8_lossy(&bytes));+ (!vars.is_empty()).then_some(vars)+}++/// Parse `env` output between the markers. A line that does not start a+/// `NAME=` assignment continues the previous value (a multi-line variable).+#[cfg(any(unix, test))]+fn parse_shell_env(output: &str) -> Vec<(String, String)> {+ let Some((_, rest)) = output.split_once(&format!("{ENV_START}\n")) else {+ return Vec::new();+ };+ let Some((body, _)) = rest.rsplit_once(ENV_END) else {+ return Vec::new();+ };+ let mut vars: Vec<(String, String)> = Vec::new();+ for line in body.lines() {+ // bash prints exported functions as `BASH_FUNC_name%%=() {`; they+ // start an entry (so their body lines don't join the previous+ // variable) that is dropped below.+ let assignment = line.split_once('=').filter(|(name, _)| {+ let name = name+ .strip_prefix("BASH_FUNC_")+ .and_then(|function| function.strip_suffix("%%"))+ .unwrap_or(name);+ !name.is_empty()+ && !name.starts_with(|c: char| c.is_ascii_digit())+ && name.chars().all(|c| c.is_ascii_alphanumeric() || c == '_')+ });+ match (assignment, vars.last_mut()) {+ (Some((name, value)), _) => vars.push((name.to_owned(), value.to_owned())),+ (None, Some((_, value))) => {+ value.push('\n');+ value.push_str(line);+ }+ (None, None) => {}+ }+ }+ vars.retain(|(name, _)| !name.starts_with("BASH_FUNC_"));+ vars+}++/// The user's login-shell `PATH`, when the shell environment was read.+fn login_shell_path() -> Option<&'static str> {+ login_shell_env()+ .iter()+ .rev()+ .find(|(name, _)| name == "PATH")+ .map(|(_, path)| path.as_str())+ .filter(|path| !path.is_empty())}/// The `PATH` macrod runs with: login shell first, then this process's own,@@ -248,6 +337,12 @@ fn macrod_command(app: &AppHandle) -> Result<tokio::process::Command, String> {let binary =macrod_binary(app).ok_or_else(|| "macrod is not bundled with this build".to_owned())?;let mut command = tokio::process::Command::new(binary);+ command.envs(+ login_shell_env()+ .iter()+ .filter(|(name, _)| !SHELL_ONLY_VARS.contains(&name.as_str()))+ .map(|(name, value)| (name.as_str(), value.as_str())),+ );command.env("PATH", macrod_path_env());if crate::AppEnvironment::current() == crate::AppEnvironment::Development {// A config created by this daemon must target the dev deployment,@@ -651,4 +746,27 @@ mod tests {assert_eq!(seconds, [1, 2, 4, 8, 16, 32, 60, 60, 60]);assert_eq!(restart_delay(u32::MAX), RESTART_MAX_DELAY);}++ #[test]+ fn shell_env_skips_banners_and_keeps_multiline_values() {+ let output = format!(+ "Welcome! PATH=/banner\n{ENV_START}\nPATH=/usr/bin:/bin\n\+ CLAUDE_CODE_OAUTH_TOKEN=token\nNOTE=line one\nline two\n\+ BASH_FUNC_greet%%=() {{ echo hi\n}}\nEMPTY=\n{ENV_END}\nbye\n"+ );+ assert_eq!(+ parse_shell_env(&output),+ [+ ("PATH".to_owned(), "/usr/bin:/bin".to_owned()),+ ("CLAUDE_CODE_OAUTH_TOKEN".to_owned(), "token".to_owned()),+ ("NOTE".to_owned(), "line one\nline two".to_owned()),+ ("EMPTY".to_owned(), String::new()),+ ]+ );+ }++ #[test]+ fn shell_env_without_markers_is_empty() {+ assert!(parse_shell_env("PATH=/usr/bin\n").is_empty());+ }}diff --git a/docs/agent-guide/settings.md b/docs/agent-guide/settings.mdindex 7dc05f42d6..24c1484cdd 100644--- a/docs/agent-guide/settings.md+++ b/docs/agent-guide/settings.md@@ -728,7 +728,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.-The `Runtimes` section shows built-in Macro, Cursor, and Codex configuration, followed by paired macrod runtimes. Codex's card appears only within the agents and Codex rollouts. On the desktop app only, a “This computer” card appears above the built-in runtimes: the bundled macrod daemon is set up from here with one click. `Set up` scans the machine for installed agents and names the one it will use (Claude Code first, then Codex, OpenCode, OpenClaw, Hermes); `Options` changes the agent, workspace folder, and a larger Full access choice labeled Suggested (unchecked until explicitly selected). `Set up <agent>` then walks a three-step checklist — Find an agent, Connect this computer (start, install the connector, link to the account; the pairing is approved automatically, no code is typed), Create your agent (a private `@<agent>` coding agent bound to this runtime) — and ends on `@<agent> is ready` with `Start a session`, which opens the Agents composer in Auto with that agent as the usual coding agent. A failed step shows its error and `Try again`, which resumes at the failed step. A desktop app that was never set up also shows a one-time “Run agents on this computer” prompt whose `Set up` runs the same flow in a dialog; closing the prompt sticks. Before this computer is paired, a dismissible “Run agents on this computer” invitation also appears above the Home input and the Agents new-conversation and active-session inputs; it opens Runtimes, and dismissal applies only to this user on this computer. The Runtimes settings tab stays available in the desktop app even if the newer Agents view is disabled. A running runtime with no agent bound to it offers `Create agent`. The app then keeps the daemon up: it restarts after any unexpected exit (with backoff) and on every launch until the user presses `Stop`, and any re-pairing is approved from wherever the user is in the app, not only on this card. While running the card shows the bound agent and workspace with a `Stop` action; a stopped runtime offers `Start`. The web app never shows this card. 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.+The `Runtimes` section shows built-in Macro, Cursor, and Codex configuration, followed by paired macrod runtimes. Codex's card appears only within the agents and Codex rollouts. On the desktop app only, a “This computer” card appears above the built-in runtimes: the bundled macrod daemon is set up from here with one click. `Set up` scans the machine for installed agents and names the one it will use (Claude Code first, then Codex, OpenCode, OpenClaw, Hermes); `Options` changes the agent, workspace folder, and a larger Full access choice labeled Suggested (unchecked until explicitly selected). `Set up <agent>` then walks a three-step checklist — Find an agent, Connect this computer (start, install the connector, link to the account; the pairing is approved automatically, no code is typed), Create your agent (a private `@<agent>` coding agent bound to this runtime) — and ends on `@<agent> is ready` with `Start a session`, which opens the Agents composer in Auto with that agent as the usual coding agent. A failed step shows its error and `Try again`, which resumes at the failed step. A desktop app that was never set up also shows a one-time “Run agents on this computer” prompt whose `Set up` runs the same flow in a dialog; closing the prompt sticks. Before this computer is paired, a dismissible “Run agents on this computer” invitation also appears above the Home input and the Agents new-conversation and active-session inputs; its `Set up` runs the same flow in a dialog in place, and dismissal applies only to this user on this computer. The Runtimes settings tab stays available in the desktop app even if the newer Agents view is disabled. A running runtime with no agent bound to it offers `Create agent`. The daemon runs with the user's interactive login-shell environment (variables exported from `.zshrc` and the like), so agents authenticate as they do in a terminal. The app then keeps the daemon up: it restarts after any unexpected exit (with backoff) and on every launch until the user presses `Stop`, and any re-pairing is approved from wherever the user is in the app, not only on this card. While running the card shows the bound agent and workspace with a `Stop` action; a stopped runtime offers `Start`. The web app never shows this card. 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 usesthe same live model discovery and retains its existing save action.