pub struct PolicyFileStore { /* private fields */ }Expand description
Apply a backend-independent WorkspacePolicy to a session filesystem.
Every model-driven read, listing, search, write, create, and delete flows
through the same policy regardless of the concrete provider. Starter-file
seeding bypasses the policy because it is trusted application configuration;
later model access to a seeded path is still checked normally. Custom
providers must honor the canonical-path contract of
SessionFileSystem::resolve_path.
Implementations§
Source§impl PolicyFileStore
impl PolicyFileStore
Sourcepub fn new(
inner: Arc<dyn SessionFileSystem>,
policy: WorkspacePolicy,
) -> PolicyFileStore
pub fn new( inner: Arc<dyn SessionFileSystem>, policy: WorkspacePolicy, ) -> PolicyFileStore
Wrap inner with policy.
Trait Implementations§
Source§impl SessionFileSystem for PolicyFileStore
impl SessionFileSystem for PolicyFileStore
Source§fn display_root(&self) -> String
fn display_root(&self) -> String
Human-facing root path for this filesystem. Read more
Source§fn display_path(&self, path: &str) -> String
fn display_path(&self, path: &str) -> String
Convert a canonical session path into a human-facing path. Read more
Source§fn resolve_path(&self, input: &str) -> String
fn resolve_path(&self, input: &str) -> String
Resolve an input path (any accepted spelling, relative or absolute) to an
absolute path within this filesystem’s namespace. Relative inputs resolve
against the filesystem’s current directory. Read more
Source§fn is_mount_resolver(&self) -> bool
fn is_mount_resolver(&self) -> bool
Whether this store is already a mount-based resolver ([
MountFs]). Read moreSource§fn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SessionFile>, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PolicyFileStore: 'async_trait,
fn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SessionFile>, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PolicyFileStore: 'async_trait,
Read a file by path
Source§fn write_file<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
content: &'life2 str,
encoding: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<SessionFile, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
PolicyFileStore: 'async_trait,
fn write_file<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
content: &'life2 str,
encoding: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<SessionFile, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
PolicyFileStore: 'async_trait,
Write/create a file
Source§fn write_file_if_content_matches<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
expected_content: &'life2 str,
expected_encoding: &'life3 str,
content: &'life4 str,
encoding: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SessionFile>, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
PolicyFileStore: 'async_trait,
fn write_file_if_content_matches<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
expected_content: &'life2 str,
expected_encoding: &'life3 str,
content: &'life4 str,
encoding: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SessionFile>, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
PolicyFileStore: 'async_trait,
Write a file only if its current content snapshot still matches. Read more
Source§fn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
recursive: bool,
) -> Pin<Box<dyn Future<Output = Result<bool, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PolicyFileStore: 'async_trait,
fn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
recursive: bool,
) -> Pin<Box<dyn Future<Output = Result<bool, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PolicyFileStore: 'async_trait,
Delete a file or directory
Source§fn list_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FileInfo>, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PolicyFileStore: 'async_trait,
fn list_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FileInfo>, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PolicyFileStore: 'async_trait,
List files in a directory
Source§fn stat_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<FileStat>, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PolicyFileStore: 'async_trait,
fn stat_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<FileStat>, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PolicyFileStore: 'async_trait,
Get file metadata
Source§fn grep_files<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
pattern: &'life1 str,
path_pattern: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<GrepMatch>, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PolicyFileStore: 'async_trait,
fn grep_files<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
pattern: &'life1 str,
path_pattern: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<GrepMatch>, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PolicyFileStore: 'async_trait,
Search file contents with Rust regex syntax, optionally filtering canonical paths by glob. Read more
Source§fn grep_files_with_options<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
pattern: &'life1 str,
options: &'life2 GrepOptions,
) -> Pin<Box<dyn Future<Output = Result<GrepSearchResult, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PolicyFileStore: 'async_trait,
fn grep_files_with_options<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
pattern: &'life1 str,
options: &'life2 GrepOptions,
) -> Pin<Box<dyn Future<Output = Result<GrepSearchResult, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PolicyFileStore: 'async_trait,
Search with match pagination and bounded before/after context. Read more
Source§fn create_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<FileInfo, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PolicyFileStore: 'async_trait,
fn create_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<FileInfo, AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PolicyFileStore: 'async_trait,
Create a directory
Source§fn seed_initial_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
file: &'life1 InitialFile,
) -> Pin<Box<dyn Future<Output = Result<(), AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PolicyFileStore: 'async_trait,
fn seed_initial_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: TypedId<SessionIdMarker>,
file: &'life1 InitialFile,
) -> Pin<Box<dyn Future<Output = Result<(), AgentLoopError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PolicyFileStore: 'async_trait,
Seed a starter file into a session workspace.
Auto Trait Implementations§
impl !RefUnwindSafe for PolicyFileStore
impl !UnwindSafe for PolicyFileStore
impl Freeze for PolicyFileStore
impl Send for PolicyFileStore
impl Sync for PolicyFileStore
impl Unpin for PolicyFileStore
impl UnsafeUnpin for PolicyFileStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request