pub trait FilePolicy: Send + Sync {
Show 13 methods
// Required methods
fn is_secret(&self, path: &Path) -> bool;
fn is_secret_ignoring_name_shape(&self, path: &Path) -> bool;
fn is_sensitive(&self, path: &Path) -> bool;
// Provided methods
fn declare_path(&self, path: &str) -> String { ... }
fn attaches_images(&self) -> bool { ... }
fn shell_tool_name(&self) -> &str { ... }
fn delivery_hint(&self) -> Option<&str> { ... }
fn keeps_backups(&self) -> bool { ... }
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 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 write_effects(
&self,
_backend: &dyn ExecutionBackend,
_arguments: &str,
) -> CallEffects { ... }
fn plants_configuration(&self, _path: &str) -> bool { ... }
fn refusal_hint(&self, _path: &Path) -> Option<String> { ... }
}Expand description
What an application decides about the file tools.
Required Methods§
Sourcefn 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.
Sourcefn 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.
Provided Methods§
Sourcefn declare_path(&self, path: &str) -> String
fn declare_path(&self, path: &str) -> String
The path a kernel access manifest declares for a path argument.
Sourcefn attaches_images(&self) -> bool
fn attaches_images(&self) -> bool
Whether images are returned as attachments the caller can deliver.
Sourcefn shell_tool_name(&self) -> &str
fn shell_tool_name(&self) -> &str
The tool named in hints that suggest running a command.
Sourcefn delivery_hint(&self) -> Option<&str>
fn delivery_hint(&self) -> Option<&str>
A sentence added after an append, on delivering the finished file.
Sourcefn keeps_backups(&self) -> bool
fn keeps_backups(&self) -> bool
Whether FilePolicy::backup_before_overwrite keeps a copy.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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).
Sourcefn 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).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".