pub struct FileHooks { /* private fields */ }Expand description
The guards of one working directory (the session’s, or a worktree subagent’s), answering the host’s
files.before_write and shell checks, and checking what each cell changed (FileHooks).
Implementations§
Source§impl FileHooks
impl FileHooks
pub fn new(cwd: impl Into<PathBuf>) -> Self
Sourcepub fn with_snapshots(cwd: impl Into<PathBuf>, snapshot: Snapshotter) -> Self
pub fn with_snapshots(cwd: impl Into<PathBuf>, snapshot: Snapshotter) -> Self
Hooks that also check what each cell changed, picturing the directory with snapshot.
pub fn add(&mut self, guard: Box<dyn FileWriteGuard>)
Sourcepub fn protect(&self, paths: Vec<PathBuf>, home: &Path)
pub fn protect(&self, paths: Vec<PathBuf>, home: &Path)
No cell writes paths (files, or directories with everything in them) through write()/edit() or a
shell command that names one: they are the user’s to change (the profile’s settings, keys and skills).
home is the home directory a command may name them from.
Sourcepub fn observe(&self, observer: Arc<dyn CellObserver>)
pub fn observe(&self, observer: Arc<dyn CellObserver>)
observer sees what each cell changed (after the guards); its lines go with the lane’s next cell result.
Sourcepub fn ignore_outside(&self, changes: OutsideChanges)
pub fn ignore_outside(&self, changes: OutsideChanges)
Files changes records as changed outside the cells are not a cell’s changes (unless it changed them
again), and an after-cell check waits for that work to end first.
Sourcepub fn on_record(&self, on_record: OnRecord)
pub fn on_record(&self, on_record: OnRecord)
Every guard outcome goes to on_record (ULTRON_LOKI_LOG).
Sourcepub fn begin_turn(&self)
pub fn begin_turn(&self)
A new root turn began: per-turn times start from zero.
Sourcepub fn stats(&self) -> Vec<GuardStats>
pub fn stats(&self) -> Vec<GuardStats>
Each guard’s statistics, in registration order.
Sourcepub fn watches_cells(&self) -> bool
pub fn watches_cells(&self) -> bool
True when some guard wants to see changes after each cell (snapshots are taken only then).
Sourcepub fn cell_started(&self, lane: &str)
pub fn cell_started(&self, lane: &str)
A cell is starting on lane: the directory as it is now is what its end is compared with. While no other
lane’s cell runs that is the latest picture (taken after the previous cell); otherwise a picture is taken now,
so the other lane’s changes made before this start are not this lane’s.
Sourcepub fn cell_ended(&self, lane: &str)
pub fn cell_ended(&self, lane: &str)
A cell on lane ended: in the background, diff the directory against the lane’s picture from the cell’s
start and give the guards the files changed by other means than checked writes. Returns at once;
Self::settled waits.
Sourcepub fn take_pending(&self, lane: &str) -> Option<String>
pub fn take_pending(&self, lane: &str) -> Option<String>
Findings from after-cell checks not yet shown to lane, as one block of text (and forget them).
Trait Implementations§
Source§impl Guard for FileHooks
impl Guard for FileHooks
Source§fn before_shell(&self, lane: &str, command: &str) -> Option<String>
fn before_shell(&self, lane: &str, command: &str) -> Option<String>
beforeShell of a command on lane: commands that may write no file, or with no shell guard, are allowed
at once. Some(reasons) blocks it. Notes (a guard that could not check, advise-only refusals) are not shown
for shell commands.
Source§fn before_write(&self, lane: &str, path: &str, content: &str) -> Value
fn before_write(&self, lane: &str, path: &str, content: &str) -> Value
beforeWrite of one proposed write on lane: every enabled guard, in parallel, each within its time limit.
Source§fn guard_stats(&self) -> Vec<Value>
fn guard_stats(&self) -> Vec<Value>
fileHooks.stats()), for rlm.pool.Source§fn begin_turn(&self)
fn begin_turn(&self)
Source§fn cell_started(&self, lane: &str)
fn cell_started(&self, lane: &str)
lane is starting (after-cell checks take their baseline).Source§fn cell_ended(&self, lane: &str)
fn cell_ended(&self, lane: &str)
lane ended (after-cell checks start in the background).