tui: /yolo works while a turn runs; '!' on permission prompt allows and enables yolo
This commit is contained in:
1 parent
43944eb6b5
commit
5171e7458a
3 files changed
+18
-2
No files matched your search
@@ -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 `<session>.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.
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user