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): suggest and enlarge permission bypass choices (#8985)

Wolf Mermelstein0e6c7a70b634
diff --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.tsx
index ae6a0c3de9..a155f1f905 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
@@ -342,18 +342,23 @@ function SetupOptions(props: {
{t('localRuntime.workspaceHint')}
</p>
</div>
- <label class="flex w-fit items-start gap-2 text-sm text-ink">
+ <label class="flex w-full items-start gap-3 rounded-lg border border-edge-muted p-4 text-sm text-ink">
<input
type="checkbox"
- class="mt-0.5"
+ class="mt-0.5 size-5 shrink-0 accent-accent"
checked={props.fullAccess}
onChange={(event) =>
props.onFullAccess(event.currentTarget.checked)
}
/>
<span>
- {t('localRuntime.fullAccess')}
- <span class="block text-xs text-ink-extra-muted">
+ <span class="flex flex-wrap items-center gap-2 font-semibold">
+ {t('localRuntime.fullAccess')}
+ <span class="rounded-full bg-ink/6 px-2 py-0.5 text-xs font-medium text-ink-muted">
+ {t('localRuntime.suggested')}
+ </span>
+ </span>
+ <span class="mt-1 block text-sm text-ink-muted">
{t('localRuntime.fullAccessHint')}
</span>
</span>
diff --git a/apps/web/src/features/settings/Agents.tsx b/apps/web/src/features/settings/Agents.tsx
index ba8a3abb9f..a61dde5548 100644
--- a/apps/web/src/features/settings/Agents.tsx
+++ b/apps/web/src/features/settings/Agents.tsx
@@ -1427,6 +1427,7 @@ function AgentEditorPage(props: {
name="agent-permission-policy"
value="bypass"
title="Always bypass"
+ suggested
description="Approve tool calls without asking."
checked={autoAcceptPermissions()}
onChange={() => setAutoAcceptChoice(true)}
diff --git a/apps/web/src/features/settings/primitives.tsx b/apps/web/src/features/settings/primitives.tsx
index 467775c459..fdd1d2c52c 100644
--- a/apps/web/src/features/settings/primitives.tsx
+++ b/apps/web/src/features/settings/primitives.tsx
@@ -309,14 +309,17 @@ export function ChoiceRow(props: {
checked: boolean;
title: string;
description: string;
+ suggested?: boolean;
disabled?: boolean;
onChange: () => void;
}) {
return (
<label
- class="flex min-w-0 items-start gap-3 rounded-lg border border-edge-muted p-3 has-checked:border-accent has-checked:bg-accent-bg"
+ class="flex min-w-0 items-start gap-3 rounded-lg border border-edge-muted has-checked:border-accent has-checked:bg-accent-bg"
classList={{
'cursor-not-allowed opacity-50': props.disabled,
+ 'p-4': props.suggested,
+ 'p-3': !props.suggested,
}}
>
<input
@@ -330,7 +333,14 @@ export function ChoiceRow(props: {
class="mt-0.5 accent-accent"
/>
<span class="min-w-0">
- <span class="block text-sm font-medium text-ink">{props.title}</span>
+ <span class="flex flex-wrap items-center gap-2 text-sm font-medium text-ink">
+ {props.title}
+ <Show when={props.suggested}>
+ <span class="rounded-full bg-ink/6 px-2 py-0.5 text-xs font-medium text-ink-muted">
+ Suggested
+ </span>
+ </Show>
+ </span>
<span class="mt-0.5 block text-sm text-ink-muted">
{props.description}
</span>
diff --git a/apps/web/src/lib/i18n/locales/en/local-runtime.ts b/apps/web/src/lib/i18n/locales/en/local-runtime.ts
index d470547177..37d1f9f9ac 100644
--- a/apps/web/src/lib/i18n/locales/en/local-runtime.ts
+++ b/apps/web/src/lib/i18n/locales/en/local-runtime.ts
@@ -14,6 +14,7 @@ export default {
workspaceLabel: 'Workspace folder',
workspaceHint: "Where sessions run. Created if it doesn't exist.",
fullAccess: 'Full access',
+ suggested: 'Suggested',
fullAccessHint:
'Let agents run commands and edit files without asking each time.',
connectorHint: 'A small connector is downloaded on first start.',
diff --git a/crates/coding_agent_worker/src/tui/quickstart/test.rs b/crates/coding_agent_worker/src/tui/quickstart/test.rs
index 126e72cce9..d6e9b78dca 100644
--- a/crates/coding_agent_worker/src/tui/quickstart/test.rs
+++ b/crates/coding_agent_worker/src/tui/quickstart/test.rs
@@ -180,9 +180,21 @@ fn quickstart_renders_permission_consent_and_warning() {
}),
Vec::new(),
);
- for allowed in [false, true] {
+ for (width, height, allowed, status) in [
+ (100, 40, false, false),
+ (100, 40, true, false),
+ (80, 26, false, false),
+ (80, 26, true, false),
+ (80, 26, false, true),
+ (80, 26, true, true),
+ (80, 24, false, false),
+ (80, 24, true, false),
+ (80, 24, false, true),
+ (80, 24, true, true),
+ ] {
setup.allow_permission_bypass = allowed;
- let mut terminal = Terminal::new(TestBackend::new(100, 40)).unwrap();
+ setup.status = status.then(|| ("Pairing failed".to_owned(), true));
+ let mut terminal = Terminal::new(TestBackend::new(width, height)).unwrap();
terminal
.draw(|frame| {
crate::tui::ui::render_quickstart(
@@ -211,7 +223,7 @@ fn quickstart_renders_permission_consent_and_warning() {
.backend()
.buffer()
.content()
- .chunks(100)
+ .chunks(usize::from(width))
.map(|row| row.iter().map(|cell| cell.symbol()).collect::<String>())
.collect::<Vec<_>>();
let workspace = rows.iter().find(|row| row.contains("Workspace")).unwrap();
@@ -220,8 +232,16 @@ fn quickstart_renders_permission_consent_and_warning() {
.find(|row| row.contains("Access") && !row.contains("Full Access"))
.unwrap();
let full_access = rows.iter().find(|row| row.contains("Full Access")).unwrap();
- assert_eq!(workspace.find("/existing/workspace"), scope.find("Team"));
- assert_eq!(workspace.find("/existing/workspace"), full_access.find('['));
+ // Borders use multibyte glyphs; compare columns rather than UTF-8 offsets.
+ let workspace_column = workspace.chars().position(|character| character == '/');
+ assert_eq!(
+ workspace_column,
+ scope.chars().position(|character| character == 'T')
+ );
+ assert_eq!(
+ workspace_column,
+ full_access.chars().position(|character| character == '[')
+ );
}
}
diff --git a/crates/coding_agent_worker/src/tui/ui/pages/config.rs b/crates/coding_agent_worker/src/tui/ui/pages/config.rs
index 1fc89af910..51930555a6 100644
--- a/crates/coding_agent_worker/src/tui/ui/pages/config.rs
+++ b/crates/coding_agent_worker/src/tui/ui/pages/config.rs
@@ -1,13 +1,16 @@
+#[cfg(test)]
+mod test;
+
use ratatui::Frame;
-use ratatui::layout::Rect;
+use ratatui::layout::{Constraint, Layout, Rect};
use ratatui::style::{Style, Stylize as _};
-use ratatui::widgets::Paragraph;
+use ratatui::widgets::{Block, BorderType, Borders, Padding, Paragraph};
use super::super::layout::render_input;
use super::super::theme::{ACCENT, DIM, WARN, card, focus_marker, focus_style, section};
use crate::config::IdentityScope;
use crate::tui::app::{App, Mode};
-use crate::tui::config_form::settings;
+use crate::tui::config_form::{Setting, settings};
pub(super) fn render(frame: &mut Frame, app: &App, area: Rect) {
let block = card(format!("macrod.toml · {}", app.config_path.display()));
@@ -15,32 +18,83 @@ pub(super) fn render(frame: &mut Frame, app: &App, area: Rect) {
frame.render_widget(block, area);
let settings = settings(&app.config);
let herdr_start = settings.iter().position(|setting| setting.is_herdr());
- // A blank line and a header sit above the herdr group.
+ let permission_index = settings
+ .iter()
+ .position(|setting| *setting == Setting::PermissionBypass);
+ // Full Access gets a bordered row; a blank line and header precede Herdr.
let row_of = |index: usize| -> u16 {
index as u16
+ + if permission_index.is_some_and(|permission| index > permission) {
+ 2
+ } else {
+ 0
+ }
+ if herdr_start.is_some_and(|start| index >= start) {
2
} else {
0
}
};
- if let Some(start) = herdr_start {
+ let team_warning = app.config.identity.scope == IdentityScope::Team;
+ let bypass_warning = app.config.identity.allow_permission_bypass;
+ let [content, warnings] = Layout::vertical([
+ Constraint::Min(0),
+ Constraint::Length(u16::from(team_warning) + if bypass_warning { 2 } else { 0 }),
+ ])
+ .areas(inner);
+ let selected_height = if settings[app.selected_setting] == Setting::PermissionBypass {
+ 3
+ } else {
+ 1
+ };
+ let scroll = (row_of(app.selected_setting) + selected_height).saturating_sub(content.height);
+ let visible_row = |offset: u16, height: u16| {
+ let offset = offset.checked_sub(scroll)?;
+ let row = Rect {
+ y: content.y + offset,
+ height,
+ ..content
+ }
+ .intersection(content);
+ if row.is_empty() { None } else { Some(row) }
+ };
+ if let Some(start) = herdr_start
+ && let Some(row) = visible_row(row_of(start) - 1, 1)
+ {
frame.render_widget(
Paragraph::new(section("Herdr", "each session in its own tab", inner.width)),
- Rect {
- y: inner.y + row_of(start) - 1,
- height: 1,
- ..inner
- },
+ row,
);
}
for (index, setting) in settings.iter().enumerate() {
let selected = index == app.selected_setting;
- let row = Rect {
- y: inner.y + row_of(index),
- height: 1,
- ..inner
+ let height = if *setting == Setting::PermissionBypass {
+ 3
+ } else {
+ 1
};
+ let Some(row) = visible_row(row_of(index), height) else {
+ continue;
+ };
+ if *setting == Setting::PermissionBypass {
+ frame.render_widget(
+ Paragraph::new(app.form.display(*setting, &app.config))
+ .style(focus_style(selected).bold())
+ .block(
+ Block::default()
+ .title(format!(
+ "{}{} · Suggested ",
+ focus_marker(selected),
+ setting.label()
+ ))
+ .borders(Borders::ALL)
+ .border_type(BorderType::Rounded)
+ .padding(Padding::horizontal(1)),
+ ),
+ row,
+ );
+ continue;
+ }
frame.render_widget(
Paragraph::new(format!("{}{:<14}", focus_marker(selected), setting.label()))
.style(focus_style(selected)),
@@ -50,7 +104,11 @@ pub(super) fn render(frame: &mut Frame, app: &App, area: Rect) {
x: row.x + 16,
width: row.width.saturating_sub(16),
..row
- };
+ }
+ .intersection(row);
+ if value_area.is_empty() {
+ continue;
+ }
match &app.mode {
Mode::EditSetting {
index: edit_index,
@@ -72,26 +130,25 @@ pub(super) fn render(frame: &mut Frame, app: &App, area: Rect) {
}
}
}
- if app.config.identity.allow_permission_bypass {
+ let [team_warning_area, bypass_warning_area] = Layout::vertical([
+ Constraint::Length(u16::from(team_warning)),
+ Constraint::Length(if bypass_warning { 2 } else { 0 }),
+ ])
+ .areas(warnings);
+ if bypass_warning {
frame.render_widget(
Paragraph::new("Warning: agents can run commands and edit files without approval.\nApplies at next pairing.")
.style(Style::new().fg(WARN)),
- Rect { y: inner.y + row_of(settings.len()) + 2, height: 2, ..inner },
+ bypass_warning_area,
);
}
- if app.config.identity.scope == IdentityScope::Team {
- let warning = Rect {
- x: inner.x,
- y: inner.y + row_of(settings.len()) + 1,
- width: inner.width,
- height: 1,
- };
+ if team_warning {
frame.render_widget(
Paragraph::new(
"Warning: teammates can command agents on this machine. Trust your team.",
)
.style(Style::new().fg(WARN)),
- warning,
+ team_warning_area,
);
}
}
diff --git a/crates/coding_agent_worker/src/tui/ui/pages/config/test.rs b/crates/coding_agent_worker/src/tui/ui/pages/config/test.rs
new file mode 100644
index 0000000000..e10b21c730
--- /dev/null
+++ b/crates/coding_agent_worker/src/tui/ui/pages/config/test.rs
@@ -0,0 +1,44 @@
+use ratatui::{Terminal, backend::TestBackend};
+
+use crate::config::IdentityScope;
+use crate::tui::app::{App, Tab};
+use crate::tui::config_form::settings;
+use crate::tui::logging::LogBuffer;
+
+#[test]
+fn short_config_keeps_selected_settings_and_consent_warnings_visible() {
+ let directory = tempfile::tempdir().unwrap();
+ let path = directory.path().join("macrod.toml");
+ std::fs::write(&path, include_str!("../../../../../default.macrod.toml")).unwrap();
+ let mut app = App::load(&path, LogBuffer::default()).unwrap();
+ app.tab = Tab::Config;
+ app.config.harness.args = vec!["herdr-acp".to_owned()];
+ app.config.identity.scope = IdentityScope::Team;
+ app.config.identity.allow_permission_bypass = true;
+ for height in [20, 24] {
+ for (index, setting) in settings(&app.config).iter().enumerate() {
+ app.selected_setting = index;
+ let mut terminal = Terminal::new(TestBackend::new(80, height)).unwrap();
+ terminal
+ .draw(|frame| crate::tui::ui::render(frame, &app))
+ .unwrap();
+ let screen = terminal
+ .backend()
+ .buffer()
+ .content()
+ .iter()
+ .map(|cell| cell.symbol())
+ .collect::<String>();
+ assert!(
+ screen.contains(setting.label()),
+ "selected setting is visible"
+ );
+ assert!(screen.contains("without approval"));
+ assert!(screen.contains("Trust your team"));
+ }
+ }
+ let mut terminal = Terminal::new(TestBackend::new(20, 10)).unwrap();
+ terminal
+ .draw(|frame| crate::tui::ui::render(frame, &app))
+ .unwrap();
+}
diff --git a/crates/coding_agent_worker/src/tui/ui/quickstart.rs b/crates/coding_agent_worker/src/tui/ui/quickstart.rs
index 69a8ab08d9..e5ed8c9688 100644
--- a/crates/coding_agent_worker/src/tui/ui/quickstart.rs
+++ b/crates/coding_agent_worker/src/tui/ui/quickstart.rs
@@ -20,13 +20,21 @@ pub(crate) fn render_quickstart(
let discovered_height = (discovered_lines(setup, 0).len() as u16 + 2).clamp(3, 12);
let area = centered(
84,
- frame.area().height.saturating_sub(2).min(36),
+ frame.area().height.saturating_sub(2).min(38),
frame.area(),
);
frame.render_widget(Clear, area);
- let block = modal("Quickstart", ACCENT).padding(Padding::new(2, 2, 1, 1));
+ let vertical_padding = u16::from(area.height >= 24);
+ let block =
+ modal("Quickstart", ACCENT).padding(Padding::new(2, 2, vertical_padding, vertical_padding));
let inner = block.inner(area);
frame.render_widget(block, area);
+ let intro_height = if setup.status.is_some() { 3 } else { 2 };
+ let permission_warning_height = if setup.allow_permission_bypass { 2 } else { 0 };
+ let scope_warning_height = u16::from(setup.scope == IdentityScope::Team);
+ // Custom, workspace, access, Full Access and submit occupy eleven fixed rows.
+ let form_height =
+ intro_height + discovered_height + 11 + permission_warning_height + scope_warning_height;
let [
intro,
discovered_area,
@@ -42,19 +50,19 @@ pub(crate) fn render_quickstart(
_details_spacer,
details_area,
] = Layout::vertical([
- Constraint::Length(3),
+ Constraint::Length(intro_height),
Constraint::Length(discovered_height),
Constraint::Length(3),
+ Constraint::Fill(1),
Constraint::Length(1),
Constraint::Length(1),
- Constraint::Length(1),
- Constraint::Length(1),
- Constraint::Length(2),
- Constraint::Min(1),
Constraint::Length(3),
- Constraint::Length(1),
- Constraint::Length(1),
- Constraint::Length(1),
+ Constraint::Length(permission_warning_height),
+ Constraint::Fill(1),
+ Constraint::Length(3),
+ Constraint::Length(scope_warning_height),
+ Constraint::Fill(1),
+ Constraint::Length(u16::from(inner.height > form_height)),
])
.areas(inner);
@@ -132,8 +140,8 @@ pub(crate) fn render_quickstart(
frame.render_widget(
Paragraph::new(Line::from(vec![
Span::styled(
- format!("{}{:<14}", focus_marker(permissions_focused), "Full Access"),
- Style::new().fg(DIM),
+ format!("{}{:<12}", focus_marker(permissions_focused), "Full Access"),
+ Style::new().bold(),
),
Span::styled(
if setup.allow_permission_bypass {
@@ -143,7 +151,16 @@ pub(crate) fn render_quickstart(
},
focus_style(permissions_focused),
),
- ])),
+ ]))
+ .block(
+ Block::default()
+ .title(" Suggested ")
+ .title_style(Style::new().bold())
+ .borders(Borders::ALL)
+ .border_type(BorderType::Rounded)
+ .border_style(Style::new().fg(THEME.border))
+ .padding(Padding::horizontal(1)),
+ ),
permissions_area,
);
if setup.allow_permission_bypass {
diff --git a/docs/agent-guide/ai-chat.md b/docs/agent-guide/ai-chat.md
index 10aba8fdd0..bc9976f107 100644
--- a/docs/agent-guide/ai-chat.md
+++ b/docs/agent-guide/ai-chat.md
@@ -1896,13 +1896,17 @@ must stay hidden; subsequent live messages must still appear.
`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
- 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.
+ default. Quickstart and Config give Full Access a bordered, three-line control
+ labeled `Suggested`, without enabling it. On short terminals, Config scrolls to
+ the selected setting and keeps consent warnings below it; Quickstart keeps its
+ submit button visible. The choice applies at the next pairing:
+ off disables bypass in the 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
- Macro, in-memory, Cursor, and Codex runtimes always bypass and have no
+ and `Always bypass` only for local macrod harnesses. The larger `Always bypass`
+ choice is labeled `Suggested`; the label does not select it. Macrod defaults to
+ prompts; bypass requires both harness consent and the agent's explicit choice.
+ Built-in Macro, in-memory, Cursor, and Codex runtimes always bypass and have no
permission policy selector. The backend enforces these policies.
Locally sent user messages in both AI implementations enter with a short upward
diff --git a/docs/agent-guide/settings.md b/docs/agent-guide/settings.md
index aa596f535b..419e3ed1e3 100644
--- a/docs/agent-guide/settings.md
+++ b/docs/agent-guide/settings.md
@@ -681,7 +681,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 Full access. `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. 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. 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.
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.