permissions: --yolo, command-aware allow rules, load allow.json
This commit is contained in:
1 parent
b36559bd95
commit
23dc8cd36e
6 files changed
+148
-36
No files matched your search
@@ -53,6 +53,8 @@ pub struct Setup {
|
||||
pub open_sessions: bool,
|
||||
/// Capture the mouse (wheel scrolling); terminal text selection then needs shift-drag.
|
||||
pub mouse: bool,
|
||||
/// No permission prompts (`--yolo`).
|
||||
pub yolo: bool,
|
||||
/// MCP servers for the side panel: (name, connected).
|
||||
pub mcp: Vec<(String, bool)>,
|
||||
}
|
||||
@@ -234,6 +236,7 @@ pub async fn run(setup: Setup) -> std::io::Result<()> {
|
||||
specs,
|
||||
open_sessions,
|
||||
mouse,
|
||||
yolo,
|
||||
mcp,
|
||||
} = setup;
|
||||
let (tx, mut rx) = mpsc::unbounded_channel();
|
||||
@@ -250,7 +253,7 @@ pub async fn run(setup: Setup) -> std::io::Result<()> {
|
||||
Box::pin(async move { orx.await.unwrap_or(false) })
|
||||
}));
|
||||
}
|
||||
{
|
||||
if !yolo {
|
||||
let tx = tx.clone();
|
||||
let _ = agent.cx.state.permit.set(std::sync::Arc::new(move |r| {
|
||||
let (otx, orx) = tokio::sync::oneshot::channel();
|
||||
@@ -270,6 +273,12 @@ pub async fn run(setup: Setup) -> std::io::Result<()> {
|
||||
let _ = agent.cx.state.subs.events.set(stx);
|
||||
let abort: AbortHandle = agent.abort_handle();
|
||||
let cwd = agent.cx.cwd.clone();
|
||||
*agent
|
||||
.cx
|
||||
.state
|
||||
.allow
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner()) = hx_core::permit::Allow::load(&cwd);
|
||||
let mut app = App {
|
||||
t: Transcript::default(),
|
||||
ed: Editor::default(),
|
||||
|
||||
Reference in new issue
Block a user