TUI: permission prompt, /diff review, /stats dashboard, lens/context/MCP side panel
This commit is contained in:
1 parent
4a8e920ab8
commit
5fd7044a2f
15 files changed
+945
-2
No files matched your search
@@ -7,6 +7,7 @@ pub mod context;
|
||||
pub mod ext;
|
||||
pub mod hook;
|
||||
mod mask;
|
||||
pub mod permit;
|
||||
pub mod session;
|
||||
pub mod stats;
|
||||
pub mod subagent;
|
||||
@@ -54,6 +55,12 @@ pub struct State {
|
||||
pub seen: Mutex<HashMap<PathBuf, Option<SystemTime>>>,
|
||||
/// Set by interactive frontends; None = nobody to ask (print mode, mcp-serve).
|
||||
pub ask: std::sync::OnceLock<Ask>,
|
||||
/// Permission prompt for bash/write/edit; unset = everything runs.
|
||||
pub permit: std::sync::OnceLock<permit::Permit>,
|
||||
/// Rules the user allowed for good.
|
||||
pub allow: Mutex<permit::Allow>,
|
||||
/// Every write/edit this session, for `/review`.
|
||||
pub edits: Mutex<Vec<permit::FileEdit>>,
|
||||
/// Same for multiple-choice questions.
|
||||
pub choose: std::sync::OnceLock<Choose>,
|
||||
/// The owning agent's abort signal (set by `Agent::new`), so subagents stop with it.
|
||||
@@ -81,6 +88,17 @@ impl State {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn log_edit(&self, p: &std::path::Path, old: Option<String>, new: &str) {
|
||||
self.edits
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner())
|
||||
.push(permit::FileEdit {
|
||||
path: p.to_path_buf(),
|
||||
old,
|
||||
new: new.into(),
|
||||
});
|
||||
}
|
||||
|
||||
pub fn mark_seen(&self, p: &std::path::Path) {
|
||||
let m = std::fs::metadata(p).and_then(|m| m.modified()).ok();
|
||||
self.seen
|
||||
|
||||
Reference in new issue
Block a user