From 5171e7458a9f5f867dc2d41bb23bb51e31c186a5 Mon Sep 17 00:00:00 2001 From: hermes Date: Sat, 17 Oct 2026 13:52:39 +0000 Subject: [PATCH] tui: /yolo works while a turn runs; '!' on permission prompt allows and enables yolo --- README.md | 2 +- crates/hx-core/src/permit.rs | 4 ++++ crates/hx-tui/src/lib.rs | 14 +++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e440b4b..2b890f9 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ tests = "turn_end" # affected tests: turn_end | agent_end | off ## Subagents -Permissions: only writes ask. `write`/`edit` and unknown `bash` commands prompt; `read` and read-only `bash` (`ls cat head tail wc grep rg fd pwd echo stat file du df which tree diff`, `git status|log|diff|show|branch|blame|ls-files|rev-parse`) run freely, unless chained/redirected or a path looks secret (`.env*`, `.ssh/`, `.aws/`, `*.pem`, `*.key`, `id_rsa*`, `.netrc`, `.git-credentials`, `auth.json`), which asks first. `--yolo` skips all prompts. +Permissions: only writes ask. `write`/`edit` and unknown `bash` commands prompt; `read` and read-only `bash` (`ls cat head tail wc grep rg fd pwd echo stat file du df which tree diff`, `git status|log|diff|show|branch|blame|ls-files|rev-parse`) run freely, unless chained/redirected or a path looks secret (`.env*`, `.ssh/`, `.aws/`, `*.pem`, `*.key`, `id_rsa*`, `.netrc`, `.git-credentials`, `auth.json`), which asks first. `--yolo` skips all prompts; `/yolo` toggles it live (also while a turn runs), `!` on a permission prompt allows it and turns yolo on. The model can call `task(prompt, kind)` (or `task(prompts=[…], kind)` to fan out: one subagent per prompt, parallel, answers returned numbered; a lone task blocks the parent, so the tool description steers the model to batches) to run a subagent with a fresh context and get back only its final answer (cut at 8 KB), so big searches don't fill the main context. `explore` (default) is read-only (`read`, `lsp`, `bash`) on the provider's cheapest model (`explore_model` in config); `general` has the parent's tools and model, and the lens runs on its edits. Up to 3 run in parallel, none can start another, a parent abort stops them. Their sessions are written to `.sub/`; `hx stats` shows `task` usage (calls, lone vs. batched turns) and lists them and the footer token counts include them. **Overview:** while any subagent exists, a list sits above the footer (bottom right: spinner/✓, id, kind, task, time, calls, tokens). `ctrl-g` focuses it (`↑↓`, `enter` opens, `esc` closes); the detail view shows that agent's live transcript. Typing there messages the agent: while it runs the text is delivered at its next turn end (like steering the main agent), after it finished it continues that agent's conversation. `ctrl-c` aborts that agent only; `ctrl-s` sends its last answer to the main chat as `[subagent N] …`. NDJSON/RPC carry no per-agent events yet. diff --git a/crates/hx-core/src/permit.rs b/crates/hx-core/src/permit.rs index abd3210..eaa7540 100644 --- a/crates/hx-core/src/permit.rs +++ b/crates/hx-core/src/permit.rs @@ -366,6 +366,10 @@ impl Allow { }) } + pub fn yolo_on(&self) -> bool { + self.yolo + } + /// Toggle: allow everything (not persisted); returns the new state. pub fn toggle_yolo(&mut self) -> bool { self.yolo = !self.yolo; diff --git a/crates/hx-tui/src/lib.rs b/crates/hx-tui/src/lib.rs index 2f309b8..02958bd 100644 --- a/crates/hx-tui/src/lib.rs +++ b/crates/hx-tui/src/lib.rs @@ -453,6 +453,18 @@ pub async fn run(setup: Setup) -> std::io::Result<()> { dirty = true; match ev { TEvent::Key(k) if k.kind != KeyEventKind::Release && app.perm.is_some() => { + if k.code == KeyCode::Char('!') { + let mut a = app.state.allow.lock().unwrap_or_else(|e| e.into_inner()); + if !a.yolo_on() { + a.toggle_yolo(); + } + drop(a); + if let Some((p, reply)) = app.perm.take() { + app.t.push(Item::Info(format!("yolo on; allowed {} {}", p.req.tool, p.req.detail))); + let _ = reply.send(hx_core::permit::Decision::Once); + } + continue; + } if let Some((p, _)) = &mut app.perm && let Some(d) = p.key(k) && let Some((p, reply)) = app.perm.take() @@ -1272,7 +1284,7 @@ async fn submit(app: &mut App, mut line: String, c: &Ctx<'_>) { let (c, arg) = cmd .split_once(' ') .map_or((cmd, ""), |(a, b)| (a, b.trim())); - if app.busy && !matches!(c, "quit" | "btw") { + if app.busy && !matches!(c, "quit" | "btw" | "yolo") { app.t.push(Item::Error("busy; esc to abort first".into())); return; } -- 2.54.1