pub struct HostFilePolicy { /* private fields */ }Expand description
The policy for file tools on the host’s own filesystem: secret and
sensitive paths (and the application’s own files) by DaemonPaths,
images as attachments, backups before an overwrite, a syntax check after
a write, and the effects of a write (git configuration among them).
Implementations§
Source§impl HostFilePolicy
impl HostFilePolicy
Sourcepub fn new(paths: DaemonPaths, settings: HostFilePolicySettings) -> Self
pub fn new(paths: DaemonPaths, settings: HostFilePolicySettings) -> Self
A policy protecting paths, worded by settings.
Trait Implementations§
Source§impl Clone for HostFilePolicy
impl Clone for HostFilePolicy
Source§impl Debug for HostFilePolicy
impl Debug for HostFilePolicy
Source§impl FilePolicy for HostFilePolicy
impl FilePolicy for HostFilePolicy
Source§fn is_secret_ignoring_name_shape(&self, path: &Path) -> bool
fn is_secret_ignoring_name_shape(&self, path: &Path) -> bool
FilePolicy::is_secret without name-shape rules, for .env.example
style templates, which are judged by where they live.Source§fn is_sensitive(&self, path: &Path) -> bool
fn is_sensitive(&self, path: &Path) -> bool
Paths the file tools must not change.
ProtectedPathGuard enforces
these three; add it to the agent.Source§fn attaches_images(&self) -> bool
fn attaches_images(&self) -> bool
Whether images are returned as attachments the caller can deliver.
Source§fn refusal_hint(&self, path: &Path) -> Option<String>
fn refusal_hint(&self, path: &Path) -> Option<String>
Where to go instead when the file tools refuse
path: an app’s own
files can have a tool of their own (its config tool, for example).Source§fn shell_tool_name(&self) -> &str
fn shell_tool_name(&self) -> &str
The tool named in hints that suggest running a command.
Source§fn delivery_hint(&self) -> Option<&str>
fn delivery_hint(&self) -> Option<&str>
A sentence added after an append, on delivering the finished file.
Source§fn keeps_backups(&self) -> bool
fn keeps_backups(&self) -> bool
Whether
FilePolicy::backup_before_overwrite keeps a copy.Source§fn backup_before_overwrite<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
backend: &'life1 Arc<dyn ExecutionBackend>,
path: &'life2 BackendPath,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn backup_before_overwrite<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
backend: &'life1 Arc<dyn ExecutionBackend>,
path: &'life2 BackendPath,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Keep a copy of
path before it is replaced. Best effort: a failed
backup never blocks the change.Source§fn post_write_diagnostics<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
backend: &'life1 dyn ExecutionBackend,
path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn post_write_diagnostics<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
backend: &'life1 dyn ExecutionBackend,
path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Text appended to a successful write, such as a syntax check.
Source§fn write_effects(
&self,
backend: &dyn ExecutionBackend,
arguments: &str,
) -> CallEffects
fn write_effects( &self, backend: &dyn ExecutionBackend, arguments: &str, ) -> CallEffects
The effects of a write call.
Source§fn plants_configuration(&self, path: &str) -> bool
fn plants_configuration(&self, path: &str) -> bool
Whether writing
path changes configuration that later commands run
(git configuration, for example).Source§fn is_persistence(&self, path: &Path) -> bool
fn is_persistence(&self, path: &Path) -> bool
Whether writing
path plants something that runs or is obeyed later
without anyone asking (a shell start-up file, a launch agent, a git
hook, the app’s own instruction files): such a write always asks
the owner.Source§fn declare_path(&self, path: &str) -> String
fn declare_path(&self, path: &str) -> String
The path a kernel access manifest declares for a path argument.
Auto Trait Implementations§
impl Forget for HostFilePolicy
impl Freeze for HostFilePolicywhere
*const ArcInner<PathClassifier> is !null: Freeze,
PhantomData<ArcInner<PathClassifier>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
impl Move for HostFilePolicy
impl RefUnwindSafe for HostFilePolicy
impl Send for HostFilePolicy
impl Sync for HostFilePolicy
impl Unpin for HostFilePolicy
impl UnsafeUnpin for HostFilePolicywhere
*const ArcInner<PathClassifier> is !null: UnsafeUnpin,
PhantomData<ArcInner<PathClassifier>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for HostFilePolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more